Replies: 1 comment
-
|
Hi @mpritham, Those methods are not overridden because the JUL-to-Log4j bridge doesn’t provide a way to wrap JUL You’re free to implement this as an extension of This design is intentional:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context
PR #3125 added overrides to ApiLogger for JUL mutator methods (addHandler, removeHandler, setUseParentHandlers, etc.) that log a WARN via StatusLogger:
Ignoring call to `j.u.l.Logger.addHandler(...)`, since the Log4j API does not provide methods to modify the underlying implementation.I understand how this makes sense for ApiLogger: the JavaDoc describes it as the "Log4j API implementation" that explicitly does not use java.util.logging.Handler, and it only holds a reference to ExtendedLogger (a log4j-api type).
My understanding is that CoreLogger is an implementation of a JUL Logger with direct access to
org.apache.logging.log4j.core.Logger,Configurator, andLoggerConfig. It already overridessetLevel,getLevel,setUseParentHandlers,getUseParentHandlers, andgetParentwith working implementations.However,
CoreLoggerdoesn't overrideaddHandlerorremoveHandler, so it inheritsApiLogger's new warning behavior.I'm using CoreLoggerAdapter via:
This means that even with
CoreLoggerAdapterconfigured, calls likeSLF4JBridgeHandler.install()(which callsLogger.getLogger("").addHandler(...))produce the warning.Question
Was this intentional, or would it make sense for
CoreLoggerto overrideaddHandler/removeHandleras well — either with a working implementation or at least without the warning?Thanks for all the work on Log4j!
Beta Was this translation helpful? Give feedback.
All reactions