Replace LoggerThread with single-threaded executor#545
Closed
ppkarwasz wants to merge 2 commits into
Closed
Conversation
This solves the problem of failing logger thread by replacing it with a single threaded `ExecutorService`.
ppkarwasz
force-pushed
the
new-async-file-handler
branch
from
August 20, 2022 14:09
3cb92f1 to
8b03745
Compare
aooohan
reviewed
Aug 22, 2022
Contributor
|
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. |
markt-asf
added a commit
that referenced
this pull request
Aug 25, 2022
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.
markt-asf
added a commit
that referenced
this pull request
Aug 25, 2022
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.
markt-asf
added a commit
that referenced
this pull request
Aug 25, 2022
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.
markt-asf
added a commit
that referenced
this pull request
Aug 25, 2022
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.
Contributor
|
Applied manually so I could address the lost messages on shutdown issue. |
Member
Author
|
@markt-asf, thanks for taking care of this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This provides an alternative solution to the
LoggerThreadproblems described in #544.It replaces
LoggerThreadwith a single-threadedExecutorServicealmost identical to the one used byFileHandler. This improvesAsyncFileHandlerin two aspects:Errorkills the working thread, it is regenerated by the executor service.A test is provided to ensure that the previous overflow policies work as documented.