logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saygin Arkan <saygen...@gmail.com>
Subject DailyRollingFileAppender logfile naming problem
Date Fri, 11 Jun 2010 13:09:46 GMT
Here's my configuration file

<?xml version="1.0" encoding="UTF-8" ?>

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    <root>
        <priority value="all" />
        <appender-ref ref="ConsoleAppender" />
        <appender-ref ref="DRFA" />
    </root>

    <appender name="ConsoleAppender"
class="org.apache.log4j.ConsoleAppender">
        <param name="Target" value="System.out" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%r %-5p - %m%n" />
        </layout>
    </appender>

   <appender name="DRFA" class="org.apache.log4j.DailyRollingFileAppender">

<param name="File" value="/home/saygin/MPICorr/logs/${logfile.name}"/>
<param name="DatePattern" value="yyyy-MM-dd"/>
<param name="MaxBackupIndex" value="30"/>

<layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS} %r
%-5p [%t] - %m%n" />
</layout>
   </appender>
</log4j:configuration>

I use MPI code and I'd like to create a log file specific for rank.
Therefore I've added c++ code such as

        string logFileName = "rank(" + rank + ")";
setenv("logfile.name", logFileName.c_str(), 1);
LoggerPtr logger(Logger::getLogger("rank(" + rank + ")"));

It produces rank(0) log file, (NOT rank(0).2010-12-12 or sth) but it does
not add the date or time information somehow.
Am I missing something ? Should I do something different with "DatePattern"
parameter?

-- 
H. Saygin Arkan
Tampere University of Tech.
CS / III - +358466646156

Mime
View raw message