Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tinylog doesn't seem to log on different thread on android #757

Open
leschbenedikt opened this issue Sep 11, 2024 · 2 comments
Open

Tinylog doesn't seem to log on different thread on android #757

leschbenedikt opened this issue Sep 11, 2024 · 2 comments
Labels

Comments

@leschbenedikt
Copy link

leschbenedikt commented Sep 11, 2024

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?

Screenshot 2024-09-11 at 14 27 07 Screenshot 2024-09-11 at 14 23 06

To Reproduce
Steps to reproduce the behavior:
Hard to reproduce, happens randomly

Environment
tinylog version: 2.7.0
Android Version: 13
Java version: 8

@pmwmedia pmwmedia added question and removed bug labels Jan 4, 2025
@pmwmedia
Copy link
Member

pmwmedia commented Jan 4, 2025

The writing thread has to be enabled globally instead on a writer.

Just replace

writer2.writingthread = true

with

writingthread = true

@leschbenedikt
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants