Writing logs with Tinylog on Android

436 views Asked by At

I want to save logs on Android using tinylog and I have added dependencies and configuration file. Sometimes the file is created with content and other times the file is empty. It seems like random behavior. Also the app has writing and reading permissions.

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

I have added this on graddle.

implementation 'org.tinylog:tinylog-api:2.1.0'
implementation 'org.tinylog:tinylog-impl:2.1.0'

I have put my tinylog.properties file inside src/main/resources

writer1 = logcat
writer1.level = debug

writer2 = rolling file
writer2.level = trace
writer2.format = {date} [{thread}] {level}:\n{message}
writer2.file  = /storage/emulated/0/app/logs/log_{date:yyyyMMdd}.txt
writer2.charset  = UTF-8
writer2.append = true
writer2.policies = daily: 03:00

writingthread = true
0

There are 0 answers