Closed siddhant123-geek closed 7 months ago
@pmwmedia Please help me with it.
Can you create a minimal reproduction project? Just fork tinylog-android-example, add your tinylog.properties
, and add your storage permissions to the forked project. If we are able to reproduce your issue by using the official Android example project, we can probably find the root cause for your issue.
@pmwmedia Current Status - After some more adding some media permissions I am able to write to the file when using write: file But still when I try to use writer: Rolling File, and to check if the previous files are stores in the arhives I keep a miniml size in the policy. You can find my tinylog.properties file over here - writer = rolling file writer.directory = /storage/emulated/0/Android/data/com.palisisag.pitapp/files writer.file = /storage/emulated/0/Android/data/com.palisisag.pitapp/files/myLogFile.txt
writer.policies = size:10
writer.archiveNumbering = DateAndSequence writer.archiveDateFormat = yyyy-MM-dd writer.maxArchiveFiles = 1000
writer.format = {date: HH:mm:ss.SSS} {class}.{method}() {level}: {message}
But the thing is now I can only see the last log in my myLogFile.txt and I do not find my previous logs, I am really confused regarding the where the previous logs are going. And also I can see the tinyLogs implementation with Android API 34(using Kotlin), is too flaky.
Do help me with some suggestions. Thanks
Attaching the screenshot of my emulator file explorer -
Hi @pmwmedia I have fixed everything, now my tinylog.properties looks something like this - writer = rolling file writer.directory = /storage/emulated/0/Android/data/com.palisisag.pitapp/files writer.file = /storage/emulated/0/Android/data/com.palisisag.pitapp/files/archive/archivedLogFile_{count}.txt
writer.policies = startup, daily: 00:00, size:100
writer.convert = gzip
writer.backups = 10 writer.concurrentWrites = false writer.format = {date: HH:mm:ss.SSS} {class}.{method}() {level}: {message}
The only issue I am having is I want my writer.latest to point at the current log file outside the archive folder, but its giving me this warning - LOGGER WARN: Cannot create link to latest log file on Android. Any workaround for this one ?
@pmwmedia Currently I moved the last file created inside the logger directory manually to the desired desctination, let me know if you have any other better method in mind.
Android doesn't support hard links and there is no workaround. However, you will still find the latest log file in /storage/emulated/0/Android/data/com.palisisag.pitapp/files/archive/archivedLogFile_{count}.txt
. It is the file with the highest count number.
Sorry for the late response. Cool got it. So I think we have to manually do it by moving the last file outside the archived folders, as per my requirement.
Describe the bug Context - I am implementing log rotation for my Kotlin Android App using TinyLogs. I using this as my tinylog.properties file - writer = rolling file writer.directory = /storage/emulated/0/Android/data/com.palisisag.pitapp/files writer.file = /storage/emulated/0/Android/data/com.palisisag.pitapp/files/myLogFile.txt
writer.policies = startup, daily:00:00, size:50 #writer.archiveFormat = /storage/emulated/0/Android/data/com.palisisag.pitapp/files/archive/{#}.txt writer.archiveNumbering = DateAndSequence writer.archiveDateFormat = yyyy-MM-dd writer.maxArchiveFiles = 10
I am getting this error - LOGGER ERROR: Failed creating service implementation 'org.tinylog.writers.RollingFileWriter' (java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.palisisag.pitapp/files/myLogFile.txt: open failed: EACCES (Permission denied))
I am already given the permissions like - \
\
I am using Android 14 (Api 34), please someone help me fix this or let me know if I am missing on something.
# Disable concurrent writes (if supported by your implementation) # writer.concurrentWrites = false
# Define log format (optional) writer.format = {date: HH:mm:ss.SSS} {class}.{method}() {level}: {message}
Environment tinylog version: 2.7 Java version: I am using Koltin