logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Habelt, Juergen" <hab...@smt.zeiss.com>
Subject Antwort: Failed to rename log file
Date Wed, 30 Nov 2005 07:47:53 GMT




Hello,

I had the same problem with the "RollinggFileAppender" in log4cxx 0.9.7
The reason was, the log file was opened in a second process. this prevented
the first process to rename the file and the file was truncated to zero
length in its
trial to create a new empty log file (after the rename)

Regards
J├╝rgen Habelt
Software - Developer
Carl Zeiss SMS GmbH
Phone : +49 (0)3641 642945
EMail :  habelt@smt.zeiss.com



                                                                           
             "Jitendra                                                     
             Kharche"                                                      
             <Jitendra.Kharche                                          An 
             @geometricsoftwar          "Log4CXX User"                     
             e.com>                     <log4cxx-user@logging.apache.org>  
             Gesendet von:                                           Kopie 
             log4cxx-user-retu                                             
             rn-1316-habelt=sm                                       Thema 
             t.zeiss.com@loggi          Failed to rename log file          
             ng.apache.org                                                 
                                                                           
                                                                           
             29.11.2005 09:05                                              
                                                                           
                                                                           
              Bitte antworten                                              
                    an                                                     
              "Log4CXX User"                                               
             <log4cxx-user@log                                             
             ging.apache.org>                                              
                                                                           
                                                                           





Hi,

I am using Log4Cxx on Windows. I always get the following error

------------------------------------------------------------------------
-----------------------------------
Failed to rename [C:\app-name/logs/event-handler.log] to
[C:\app-name/logs/event-handler.log.2005-11-28].
------------------------------------------------------------------------
-----------------------------------

Due to this error, in order to continue writing log, Log4Cxx overwrites
the old log file. Thus I lose the old log.

I am using DailyRollingFileAppender and my config file is as given below

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "./log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="false">
             <appender name="APP_LOGFILE"
class="org.apache.log4j.DailyRollingFileAppender">
                         <errorHandler
class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
                         <param name="File"
value="${APP_HOME}/logs/event-handler.log"/>
                         <param name="Append" value="true"/>
                         <param name="Threshold" value="warn"/>

                         <!-- Rollover at midnight each day -->
                         <!--<param name="DatePattern" value="yyyy-MM-dd"/>
Does
not work-->

                         <param name="MaxFileSize" value="25MB" />
                         <param name="MaxBackupIndex" value="10" />
                         <layout class="org.apache.log4j.PatternLayout">
                                     <param name="ConversionPattern"
value="%d %-5p
[%c{1}] %m%n"/>
                         </layout>
             </appender>

             <root>
                         <appender-ref ref="APP_LOGFILE"/>
             </root>
</log4j:configuration>

Regards,
Jitendra



Mime
View raw message