Using log4j 1.2

Given this configuration file (testlog4jcfg.xml):

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="true" xmlns:log4j="http://jakarta.apache.org/log4j/"; >
    <appender name="applog" class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="AutoPublish.log" />
        <param name="DatePattern" value="'.'yyyy-MM-dd'.log'"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{DATE} %5p %t %c{2} - %m%n"/>
        </layout>
    </appender>
    
    
    <root>
        <priority value="trace"/>
        <appender-ref ref="applog" />
    </root>
</log4j:configuration>

This configuration is read by this line of code:
            DOMConfigurator.configure("testlog4jcfg.xml");

When I run this program, I get this output:

log4j: Threshold ="null". 
log4j: Level value for root is  [trace]. 
log4j: root level set to DEBUG 
log4j: Class name: [org.apache.log4j.DailyRollingFileAppender] 
log4j: Setting property [file] to [AutoPublish.log]. 
log4j: Setting property [datePattern] to ['.'yyyy-MM-dd'.log']. 
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout" 
log4j: Setting property [conversionPattern] to [%d{DATE} %5p %t %c{2} - %m%n]. 
log4j: setFile called: AutoPublish.log, true log4j: setFile ended 
log4j: Appender [applog] to be rolled at midnight. 
log4j: Adding appender named [applog] to category [root].

Why is it setting the threshold to null?  Why is it ignoring the setting of the root 
level to trace?

Second question : the program in question in this case is actually a simple JUnit test
application.  It seems to me as if some of the input is not getting to the file, even
if I make it debug, instead of trace.  Is there a timing issue here?  If the program 
exits before log output has been completed, will log output not get to the log file?  
If that is the case, and I suspect it is, is there an easy way around this?

-----------------------------------------------------------------
Steve Cohen
Sr. Software Engineer
Ignite Sports, Inc.
[EMAIL PROTECTED] 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to