Bug 55677 - Log4J not logging internal debug logs before setting debug flag
Summary: Log4J not logging internal debug logs before setting debug flag
Status: NEW
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Configurator (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: log4j-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-19 10:45 UTC by Prasanth M
Modified: 2013-10-19 10:45 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Prasanth M 2013-10-19 10:45:28 UTC
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].