Tinylog doesn't seem to log on different thread on android
Describe the bug I am occasionally getting an ANR on Android 13 which is caused by tinylog. The ANR log clearly shows that tinylog tries to write the log on the main thread although i've set the property writingthread to true.
For me this seem like a bug or am I doing something wrong?
To Reproduce Steps to reproduce the behavior: Hard to reproduce, happens randomly
Environment tinylog version: 2.7.0 Android Version: 13 Java version: 8
The writing thread has to be enabled globally instead on a writer.
Just replace
writer2.writingthread = true
with
writingthread = true
I tried this too, and it didn't seem to make any difference.
Therefore I looked into the code and I can't really find any code where an actual thread is created when the flag is set. I only find the part where the flag makes it not synchronized.
if (writingThread) { internalWrite(data); } else { synchronized (writer) { internalWrite(data); } }
Am I missing some code where an actual second thread is created or is that all setting writingThread does?
The writing thread is created here: tinylog-impl/src/main/java/org/tinylog/core/TinylogLoggingConfiguration.java#L226
To be honest, I have never seen such error before. Is the screenshot everything you got?