You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Surya Poola <su...@yahoo.com> on 2007/01/15 11:18:45 UTC
cannot write to a file with rollingfileappender in log4j1.3
Hi,
Iam new to log4j usage.My requirement is to wriite a log file and roll over monthly, but I want the file name that iam logging to be identified with date like xyz_01-2007.csv before rollover.
Iam using log4j1.3 alpha-8 with rollingfileappender but file is not created and iam not able to debug or see any errors in my program.So can anyone help me in writing to a log file with rollingfileappender, or tell me what iam doing incorrectly.
my config file looks like:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
<appender name="ROLL" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="/pkg/tomcat/suryapoola.%d{yyyy-MM}.log"/>
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n"/>
</layout>
</appender>
<root>
<appender-ref ref="ROLL"/>
</root>
</log4j:configuration>
and
iam calling in my program like:
logger=Logger.getLogger (classname.class.getName());
JoranConfigurator jc = new JoranConfigurator();
jc.doConfigure(mLOG4JCONFIGFILE, LogManager.getLoggerRepository());
logger.info("first error");
Thanks in advance
Regards
Rohan
---------------------------------
Check out the all-new Yahoo! Mail beta - Fire up a more powerful email and get things done faster.
---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.