Marcono1234 created LOG4J2-3030:
-----------------------------------

             Summary: Log4jBridgeHandler.install should be synchronized and 
check if already installed
                 Key: LOG4J2-3030
                 URL: https://issues.apache.org/jira/browse/LOG4J2-3030
             Project: Log4j 2
          Issue Type: Improvement
          Components: JUL adapter
    Affects Versions: 3.0.0
            Reporter: Marcono1234


The method 
[{{Log4jBridgeHandler.install}}|https://github.com/apache/logging-log4j2/blob/8abfd929a9c6f5ff66a734d7c37e4fd72a3baaa7/log4j-jul/src/main/java/org/apache/logging/log4j/jul/Log4jBridgeHandler.java#L105]
 is quite useful when installing the Log4j 2 handler from code, however it has 
the following disadvantages:
# It is not synchronized
# It does not check if a Log4j 2 handler is already installed

This is problematic when a project has multiple entry points and therefore has 
to call {{Log4jBridgeHandler.install}} from multiple places (even when 
happening in a {{static}} initializer because they can run concurrently for 
different classes), or when other dependencies of a project call the method.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to