-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Replace LoggerThread
with single-threaded executor
#545
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
Conversation
This solves the problem of failing logger thread by replacing it with a single threaded `ExecutorService`.
3cb92f1
to
8b03745
Compare
I think this is a better approach than the current code that uses a Thread. Therefore, I think we can close #544. I have been reviewing the PR and overall I like it. I have noticed that it is possible to lose log messages during shutdown (add a 100ms delay just before the call to publish internal to simulate a large backlog). The threading approach originally suffered from this problem as well and I think the same solution will work (register uses of the AsyncHandler and explicitly shutdown the executor during JULI shutdown). I plan on working on this today. |
Replace logging thread for JULI's AsyncFileHandlerwith an executor to protect against failure of the logging thread. Based on pull request #545 by Piotr P. Karwasz.
Replace logging thread for JULI's AsyncFileHandlerwith an executor to protect against failure of the logging thread. Based on pull request #545 by Piotr P. Karwasz.
Replace logging thread for JULI's AsyncFileHandlerwith an executor to protect against failure of the logging thread. Based on pull request #545 by Piotr P. Karwasz.
Replace logging thread for JULI's AsyncFileHandlerwith an executor to protect against failure of the logging thread. Based on pull request #545 by Piotr P. Karwasz.
Applied manually so I could address the lost messages on shutdown issue. |
@markt-asf, thanks for taking care of this. |
This provides an alternative solution to the
LoggerThread
problems described in #544.It replaces
LoggerThread
with a single-threadedExecutorService
almost identical to the one used byFileHandler
. This improvesAsyncFileHandler
in two aspects:Error
kills the working thread, it is regenerated by the executor service.A test is provided to ensure that the previous overflow policies work as documented.