logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlsen, Rasmus" <rasmus.carl...@cgi.com>
Subject RollingFile does not reset file when rolling
Date Fri, 04 Mar 2016 13:24:35 GMT
Hi
I use log4j 2.5 on weblogic 12C (By adding the argument -Dlog4j.Configuration=log4j2.xml)
with this configurationfile:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" monitorInterval="320">
   <Appenders>
       <RollingFile name="com.logica.poltacho.soap.file.appender" fileName="D:/oracle/config/domains/poltacho3/servers/server1/logs/poltacho-soap.log"
                              filePattern="D:/oracle/config/domains/poltacho3/servers/server1/logs/poltacho-soap-%i.log">
                 <PatternLayout>
                             <Pattern>%d{ISO8601} %-5p %c{1} transId: %X{transactionId}
%m%n</Pattern>
               </PatternLayout>
              <Policies>
                             <SizeBasedTriggeringPolicy size="1 MB" />
             </Policies>
            <DefaultRolloverStrategy max="4" />
       </RollingFile>
    </Appenders>
    <Loggers>
          <Logger name="com.logica.poltacho.ws.SoapHandler" level="info" additivity="false">
                   <AppenderRef ref="com.logica.poltacho.soap.file.appender" />
          </Logger>
    </Loggers>
</Configuration>


The file role when increased with about 1 MB but it is not reset! The result is that both
the logfile and new rolled files keep growing in size like this:

poltacho-soap.log        3>MB
poltacho-soap-3.log    3MB
poltacho-soap-2.log    2MB
poltacho-soap-1.log    1MB

If I add append="false" everything works fine and I get the expected result:

poltacho-soap.log        1<MB
poltacho-soap-3.log    1MB
poltacho-soap-2.log    1MB
poltacho-soap-1.log    1MB

It is just that I don't want any existing logfile to be cleared when application startup.
If I use the same log4j configuration from eclipse in unittests, everything works fine also
without append="false".

Have you seen this before and can you give me a hint for a solution?

Regards, Rasmus Carlsen


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message