log4cxx: time based rolling doesn't work -
i'd configure log4cxx via xml in order roll log file every minute. tried following log4j.xml file seems work sometimes, randomly. tried xml file using timebasedrollingpolicy doesn't work. appreciated.
<?xml version="1.0" encoding="utf-8" ?> <!doctype log4j:configuration system "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="appxrollingappenderdaily" class="org.apache.log4j.rolling.rollingfileappender"> <rollingpolicy class="org.apache.log4j.rolling.timebasedrollingpolicy"> <param name="filenamepattern" value="timebasedlog.%d{yyyy-mm-dd-hh-mm}.log"/> <param name="activefilename" value="appxdailylog.log"/> </rollingpolicy> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d{yyyy-mm-dd hh:mm:ss,sss} %x [%p] (%f:%l) %m%n"/> </layout> <param name="file" value="appxdailylog.log"/> <param name="append" value="true"/> </appender> <root> <priority value="all" /> <appender-ref ref="appxrollingappenderdaily"/> </root> </log4j:configuration>
try this:
<?xml version="1.0" encoding="utf-8" ?> <!doctype log4j:configuration system "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="appxrollingappenderdaily" class="org.apache.log4j.dailyrollingfileappender"> <param name="threshold" value="all"/> <param name="file" value="./appxdailylog.log"/> <param name="datepattern" value="'.'yyyy-mm-dd" /> <layout class="org.apache.log4j.patternlayout"> <!-- <param name="conversionpattern" value="%p %t %c - %m%n"/> --> <!-- <param name="conversionpattern" value="%d{iso8601} [%15.15t] %-5p %l - %m%n"/> --> <!-- <param name="conversionpattern" value="%d{iso8601} [%-8.8t] %-5p (%t) - %m%n"/> --> <param name="conversionpattern" value="%d{yyyy-mm-dd hh:mm:ss,sss} %x [%p] (%f:%l) %m%n"/> </layout> </appender> <root> <priority value="all" /> <appender-ref ref="appxrollingappenderdaily"/> </root> </log4j:configuration>
Comments
Post a Comment