https://issues.apache.org/bugzilla/show_bug.cgi?id=55677

            Bug ID: 55677
           Summary: Log4J not logging internal debug logs before setting
                    debug flag
           Product: Log4j
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Configurator
          Assignee: log4j-dev@logging.apache.org
          Reporter: prasanth...@gmail.com

When I was walking myself through log4j code out of mere curiosity, I observed
something weird. When log4j is initialized, the internal debugging flag is set
only after parsing the log4j.xml(<log4j:configuration debug="true">). Hence the
debug logs,before this flag is set, are not printed to the standard output.
Isn't it unseemly to log before the flag is set or any specific reason behind
this?

Actual Output
log4j: reset attribute= "false".
log4j: Threshold ="null".
log4j: Level value for root is  [info].
log4j: root level set to INFO
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Setting property [target] to [System.out].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [[%d{ISO8601}] [%t] %m%n].
log4j: Adding appender named [console] to category [root].

Expected Output
log4j: Trying to find [log4j.xml] using context classloader
sun.misc.Launcher$AppClassLoader@5f3c6654.
log4j: Using URL [file:/C:/Users/fi/Desktop/Workspace/TestLog4j/conf/log4j.xml]
for automatic log4j configuration.
log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator
log4j: System property is :null
log4j: Standard DocumentBuilderFactory search succeded.
log4j: DocumentBuilderFactory is:
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
log4j: debug attribute= "true".
log4j: reset attribute= "false".
log4j: Threshold ="null".
log4j: Level value for root is  [info].
log4j: root level set to INFO
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Setting property [target] to [System.out].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [[%d{ISO8601}] [%t] %m%n].
log4j: Adding appender named [console] to category [root].

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to