logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Yang <kenshin...@gmail.com>
Subject Log files rename failed
Date Wed, 22 Jan 2014 02:42:14 GMT
I have observed a file-rename issue while using rolling appender.
I am using log4j2-beta9.
This main reason I switched to log4j2 is because the same problem occurs in
log4j 1.x and the only way to fix it is to modify the source which is
something we dont want to do unless it's the last option, while not
modifying any of our current source code.
Therefore addition to the log4j2 core jars we also have log4j-1.2-api.jar have
to replace the original log4j we also have binding from commons-logging to
log4j2.

The environment is running on a VM with Windows Server 2008 running
Websphere 8.

My configuration looks like

<RollingFile name="wmsRollingFile" fileName="${fileroot}/wms/wms.log"
filePattern="${fileroot}/wms/wms-%d{MM-dd-yyyy}-%i.log.gz">
      <PatternLayout pattern="%d [%t] %C %l %-5p %c - %m%n"/>
      <Policies>
        <SizeBasedTriggeringPolicy size="10 MB"/>
        <TimeBasedTriggeringPolicy />
      </Policies>
</RollingFile>

<logger name="org.springframework" level="debug" additivity="false">
        <appender-ref ref="wmsRollingFile"/>
    </logger>

    <logger name="org.apache.http" level="debug" additivity="false">
        <appender-ref ref="wmsRollingFile"/>
    </logger>

    <root level="info">
      <!-- <appender-ref ref="STDOUT"/> -->
      <appender-ref ref="wmsRollingFile"/>
    </root>

I also have other appenders with similar setting but just logs to different
files. (they are not used/written much but do have same problem"

As you can see, I have set the log policy to size 10MB and by time.
What I have observed is that when it runs correctly, log files get gz at
10MB and restarts a new one and everything runs correctly. However, as soon
as one roll failed, the log size just keep increasing. When it comes to the
daily rolling part, a new file with correct timestamp is created. However
the original log file does not get cleaned up and the new logs just kept
append to the old log file. This causes log file size increase each day
with duplicated entries.

When I check the WAS error log I see something like the following:
"log4j:ERROR Failed to rename [D:/WMS_AP/logs/TWI900WMAPT01/wms/wms.log] to
[D:/WMS_AP/logs/TWI900WMAPT01/wms/wms.log_20140120.txt]."

Is there a way to see more detailed error message from log4j?
Or what could possibly be the problem? What should I investigate?

Thanks

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