-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Loggers.useConsoleLoggers() thread safety (#3174)
Although we expect that a huge majority of prod usages do use SLF4J and won't fallback to Console logging, the later is still the first choice of fallback logging factory. This commit ensures the backing cache of Loggers behind the ConsoleLoggerFactory is thread-safe, using a WeakHashMap and WeakReferences for the Logger values, as well as a synchronized block when obtaining a Logger. The documentation of Loggers.useCustomLogger(Function) is also amended to highlight the importance of thread-safety in the custom logger factories. Fixes #3170.
- Loading branch information
1 parent
e94124d
commit 91ce8ed
Showing
2 changed files
with
127 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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