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 RE: RollingFile does not reset file when rolling
Date Sun, 06 Mar 2016 04:52:54 GMT
Problem solved. Weblogic seems to load some log4j stuff in addition to the application libraries,
but you can solve the problems by specifying that your own classes should have precedence
in weblogic-application.xml


-----Original Message-----
From: Carlsen, Rasmus [mailto:rasmus.carlsen@cgi.com] 
Sent: 5. marts 2016 21:34
To: log4j-user@logging.apache.org
Subject: RE: RollingFile does not reset file when rolling

I have now tried various combinations of RollingFile and RollingRandomAccessFile and their
settings, but when used from weblogic 12C with  jdk1.8.0_74 I can simply not find a way to
make log4j clear the file after rolling, except if append="false" is added (and everything
works fine when the same configuration is used for logging in eclipse).

Among other things I also tried to remove the Policies tag below so that SizeBasedTriggerPolicy
was not enclosed by a Policies tag. That actually made things a little worse, and in addition
to not clearing the file, when rolling, there were only made one rolling file with the name
.1 instead of the 4 that was specified.

I think I will end up skipping log4j as I can't skip weblogic :(

From: Carlsen, Rasmus
Sent: 4. marts 2016 14:24
To: 'log4j-user@logging.apache.org'
Subject: RollingFile does not reset file when rolling

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">
       <RollingFile name="com.logica.poltacho.soap.file.appender" fileName="D:/oracle/config/domains/poltacho3/servers/server1/logs/poltacho-soap.log"
                             <Pattern>%d{ISO8601} %-5p %c{1} transId: %X{transactionId}
                             <SizeBasedTriggeringPolicy size="1 MB" />
            <DefaultRolloverStrategy max="4" />
          <Logger name="com.logica.poltacho.ws.SoapHandler" level="info" additivity="false">
                   <AppenderRef ref="com.logica.poltacho.soap.file.appender" />

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

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message