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 Järkeborn Joacim <jo...@volvo.com> on 2004/09/28 09:47:38 UTC

Log4J problem with RollingFileAppender and backups

Hi, 


We are using Log4J in our J2EE application with RollingFileAppender and a number of backups. 

When the appserver and application starts everything seems to work as it should, it creates the logfile and backups after the max file size have been reached. When max backup parameters are reached the files rolls away from disk. 

But when restarting the application (ear, not the appserver) it seems to lost it's track and the the files are removed one by one, starting with the logfile.log.1. 

The logfiles can not be removed as long as the appserver is started. 

Any ideas? 

Using IBM WebSphere 5.0.2/5.1 and Log4J 1.2.8. 
Configuration and trace are avialable below. 

BR 
Joacim J 

-------------------------------------------------------------------------- 
log4j config 
-------------------------------------------------------------------------- 
<log4j:configuration> 
    <appender name="A_ROOT" class="org.apache.log4j.RollingFileAppender"> 
        <param name="File" value="logs/pos.log"/> 
        <param name="Append" value="True"/> 

        <!-- Set the maximum log file size --> 
        <param name="MaxFileSize" value="64KB"/> 

        <!-- Keep two backups of the log --> 
        <param name="MaxBackupIndex" value="20"/> 

        <!-- The log layout --> 
        <layout class="org.apache.log4j.PatternLayout"> 
            <param name="ConversionPattern" value="%d %-5p %-30c{1} [%x] %m%n"/> 
        </layout> 
    </appender> 

    <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender"> 
        <param name="File" value="System.out"/> 
        <layout class="org.apache.log4j.PatternLayout"> 
            <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m\n"/> 
        </layout> 
    </appender> 

    <category name="org.apache.log4j.xml"> 
        <priority value="info"/> 
        <appender-ref ref="A_ROOT"/> 
    </category> 

    <root> 
        <priority value="debug"/> 
        <appender-ref ref="A_ROOT"/> 
    </root> 
</log4j:configuration> 



-------------------------------------------------------------------------- 
The Log4J trace: 
-------------------------------------------------------------------------- 
log4j: Standard DocumentBuilderFactory search succeded. 
log4j: DocumentBuilderFactory is: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl 
log4j: debug attribute= "null". 
log4j: Ignoring debug attribute. 
log4j: Threshold ="null". 
log4j: Retreiving an instance of org.apache.log4j.Logger. 
log4j: Setting [org.apache.log4j.xml] additivity to [true]. 
log4j: Level value for org.apache.log4j.xml is  [info]. 
log4j: org.apache.log4j.xml level set to INFO 
log4j: Class name: [org.apache.log4j.RollingFileAppender] 
log4j: Setting property [file] to [logs/pos.log]. 
log4j: Setting property [append] to [true]. 
log4j: Setting property [maxFileSize] to [64KB]. 
log4j: Setting property [maxBackupIndex] to [20]. 
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout" 
log4j: Setting property [conversionPattern] to [%d %-5p %-30c{1} [%x] %m%n]. 
log4j: setFile called: logs/pos.log, true 
log4j: setFile ended 
log4j: Adding appender named [A_ROOT] to category [org.apache.log4j.xml]. 
log4j: Level value for root is  [debug]. 
log4j: root level set to DEBUG 
log4j: Adding appender named [A_ROOT] to category [root]. 

... 

log4j: rolling over count=65682 
log4j: maxBackupIndex=20 
log4j: Renaming file logs\pos.log.19 to logs\pos.log.20 
log4j: Renaming file logs\pos.log.18 to logs\pos.log.19 
log4j: Renaming file logs\pos.log.17 to logs\pos.log.18 
log4j: Renaming file logs\pos.log.16 to logs\pos.log.17 
log4j: Renaming file logs\pos.log.15 to logs\pos.log.16 
log4j: Renaming file logs\pos.log.14 to logs\pos.log.15 
log4j: Renaming file logs\pos.log.13 to logs\pos.log.14 
log4j: Renaming file logs\pos.log.12 to logs\pos.log.13 
log4j: Renaming file logs\pos.log.11 to logs\pos.log.12 
log4j: Renaming file logs\pos.log.10 to logs\pos.log.11 
log4j: Renaming file logs\pos.log.9 to logs\pos.log.10 
log4j: Renaming file logs\pos.log.8 to logs\pos.log.9 
log4j: Renaming file logs\pos.log.7 to logs\pos.log.8 
log4j: Renaming file logs\pos.log.6 to logs\pos.log.7 
log4j: Renaming file logs\pos.log.5 to logs\pos.log.6 
log4j: Renaming file logs\pos.log.4 to logs\pos.log.5 
log4j: Renaming file logs\pos.log.3 to logs\pos.log.4 
log4j: Renaming file logs\pos.log.2 to logs\pos.log.3 
log4j: Renaming file logs\pos.log.1 to logs\pos.log.2 
log4j: Renaming file logs\pos.log to logs\pos.log.1 
log4j: setFile called: logs/pos.log, false 
log4j: setFile ended 

... [EAR RESTART] 

log4j: Standard DocumentBuilderFactory search succeded. 
log4j: DocumentBuilderFactory is: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl 
log4j: debug attribute= "null". 
log4j: Ignoring debug attribute. 
log4j: Threshold ="null". 
log4j: Retreiving an instance of org.apache.log4j.Logger. 
log4j: Setting [org.apache.log4j.xml] additivity to [true]. 
log4j: Level value for org.apache.log4j.xml is  [info]. 
log4j: org.apache.log4j.xml level set to INFO 
log4j: Class name: [org.apache.log4j.RollingFileAppender] 
log4j: Setting property [file] to [logs/pos.log]. 
log4j: Setting property [append] to [true]. 
log4j: Setting property [maxFileSize] to [64KB]. 
log4j: Setting property [maxBackupIndex] to [20]. 
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout" 
log4j: Setting property [conversionPattern] to [%d %-5p %-30c{1} [%x] %m%n]. 
log4j: setFile called: logs/pos.log, true 
log4j: setFile ended 
log4j: Adding appender named [A_ROOT] to category [org.apache.log4j.xml]. 
log4j: Level value for root is  [debug]. 
log4j: root level set to DEBUG 
log4j: Adding appender named [A_ROOT] to category [root]. 

... [RUNNING APPLICATION TO GENERATE LOGS/ROLLING FILES] 

log4j: rolling over count=65663 
log4j: maxBackupIndex=20 
log4j: Renaming file logs\pos.log.19 to logs\pos.log.20 
log4j: Renaming file logs\pos.log.18 to logs\pos.log.19 
log4j: Renaming file logs\pos.log.17 to logs\pos.log.18 
log4j: Renaming file logs\pos.log.16 to logs\pos.log.17 
log4j: Renaming file logs\pos.log.15 to logs\pos.log.16 
log4j: Renaming file logs\pos.log.14 to logs\pos.log.15 
log4j: Renaming file logs\pos.log.13 to logs\pos.log.14 
log4j: Renaming file logs\pos.log.12 to logs\pos.log.13 
log4j: Renaming file logs\pos.log.11 to logs\pos.log.12 
log4j: Renaming file logs\pos.log.10 to logs\pos.log.11 
log4j: Renaming file logs\pos.log.9 to logs\pos.log.10 
log4j: Renaming file logs\pos.log.8 to logs\pos.log.9 
log4j: Renaming file logs\pos.log.7 to logs\pos.log.8 
log4j: Renaming file logs\pos.log.6 to logs\pos.log.7 
log4j: Renaming file logs\pos.log.5 to logs\pos.log.6 
log4j: Renaming file logs\pos.log.4 to logs\pos.log.5 
log4j: Renaming file logs\pos.log.3 to logs\pos.log.4 
log4j: Renaming file logs\pos.log.2 to logs\pos.log.3 
log4j: Renaming file logs\pos.log.1 to logs\pos.log.2 
log4j: Renaming file logs\pos.log to logs\pos.log.1 
log4j: setFile called: logs/pos.log, false 
log4j: setFile ended 

... [FILES STARTS TO DISAPPEAR] 

log4j: rolling over count=65655 
log4j: maxBackupIndex=20 
log4j: Renaming file logs\pos.log.19 to logs\pos.log.20 
log4j: Renaming file logs\pos.log.18 to logs\pos.log.19 
log4j: Renaming file logs\pos.log.17 to logs\pos.log.18 
log4j: Renaming file logs\pos.log.16 to logs\pos.log.17 
log4j: Renaming file logs\pos.log.15 to logs\pos.log.16 
log4j: Renaming file logs\pos.log.14 to logs\pos.log.15 
log4j: Renaming file logs\pos.log.13 to logs\pos.log.14 
log4j: Renaming file logs\pos.log.12 to logs\pos.log.13 
log4j: Renaming file logs\pos.log.11 to logs\pos.log.12 
log4j: Renaming file logs\pos.log.10 to logs\pos.log.11 
log4j: Renaming file logs\pos.log.9 to logs\pos.log.10 
log4j: Renaming file logs\pos.log.8 to logs\pos.log.9 
log4j: Renaming file logs\pos.log.7 to logs\pos.log.8 
log4j: Renaming file logs\pos.log.6 to logs\pos.log.7 
log4j: Renaming file logs\pos.log.5 to logs\pos.log.6 
log4j: Renaming file logs\pos.log.4 to logs\pos.log.5 
log4j: Renaming file logs\pos.log.3 to logs\pos.log.4 
log4j: Renaming file logs\pos.log.2 to logs\pos.log.3 
log4j: Renaming file logs\pos.log to logs\pos.log.1 
log4j: setFile called: logs/pos.log, false 
log4j: setFile ended 

... 

log4j: rolling over count=65582 
log4j: maxBackupIndex=20 
log4j: Renaming file logs\pos.log.19 to logs\pos.log.20 
log4j: Renaming file logs\pos.log.18 to logs\pos.log.19 
log4j: Renaming file logs\pos.log.17 to logs\pos.log.18 
log4j: Renaming file logs\pos.log.16 to logs\pos.log.17 
log4j: Renaming file logs\pos.log.15 to logs\pos.log.16 
log4j: Renaming file logs\pos.log.14 to logs\pos.log.15 
log4j: Renaming file logs\pos.log.13 to logs\pos.log.14 
log4j: Renaming file logs\pos.log.12 to logs\pos.log.13 
log4j: Renaming file logs\pos.log.11 to logs\pos.log.12 
log4j: Renaming file logs\pos.log.10 to logs\pos.log.11 
log4j: Renaming file logs\pos.log.9 to logs\pos.log.10 
log4j: Renaming file logs\pos.log.8 to logs\pos.log.9 
log4j: Renaming file logs\pos.log.7 to logs\pos.log.8 
log4j: Renaming file logs\pos.log.6 to logs\pos.log.7 
log4j: Renaming file logs\pos.log.5 to logs\pos.log.6 
log4j: Renaming file logs\pos.log.4 to logs\pos.log.5 
log4j: Renaming file logs\pos.log.3 to logs\pos.log.4 
log4j: Renaming file logs\pos.log to logs\pos.log.1 
log4j: setFile called: logs/pos.log, false 
log4j: setFile ended 

... 

log4j: rolling over count=65682 
log4j: maxBackupIndex=20 
log4j: Renaming file logs\pos.log.19 to logs\pos.log.20 
log4j: Renaming file logs\pos.log.18 to logs\pos.log.19 
log4j: Renaming file logs\pos.log.17 to logs\pos.log.18 
log4j: Renaming file logs\pos.log.16 to logs\pos.log.17 
log4j: Renaming file logs\pos.log.15 to logs\pos.log.16 
log4j: Renaming file logs\pos.log.14 to logs\pos.log.15 
log4j: Renaming file logs\pos.log.13 to logs\pos.log.14 
log4j: Renaming file logs\pos.log.12 to logs\pos.log.13 
log4j: Renaming file logs\pos.log.11 to logs\pos.log.12 
log4j: Renaming file logs\pos.log.10 to logs\pos.log.11 
log4j: Renaming file logs\pos.log.9 to logs\pos.log.10 
log4j: Renaming file logs\pos.log.8 to logs\pos.log.9 
log4j: Renaming file logs\pos.log.7 to logs\pos.log.8 
log4j: Renaming file logs\pos.log.6 to logs\pos.log.7 
log4j: Renaming file logs\pos.log.5 to logs\pos.log.6 
log4j: Renaming file logs\pos.log.4 to logs\pos.log.5 
log4j: Renaming file logs\pos.log to logs\pos.log.1 
log4j: setFile called: logs/pos.log, false 
log4j: setFile ended 

 
Regards
Joacim Järkeborn
IT Architect