That's correct. I allready tried this option and it works fine, but my
intention is to start application with a new logfile combined with rolling
as specified.


Magdalena




|---------+---------------------------->
|         |           "Senthil         |
|         |           Sivasubramanian  |
|         |           S"               |
|         |           <[EMAIL PROTECTED]|
|         |           com>             |
|         |                            |
|         |           10.11.2004 12:07 |
|         |           Bitte antworten  |
|         |           an "Log4NET User"|
|         |                            |
|---------+---------------------------->
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                             
                                                                     |
  |       An:       "Log4NET User" <log4net-user@logging.apache.org>            
                                                                     |
  |       Kopie:    (Blindkopie: Magdalena Gambietz/AGGAM/MUC/AGFA/DE/BAYER)    
                                                                     |
  |       Thema:    RE: Problem with RollingFileAppender when restarting 
application                                                                 |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|




I believe you should set the "appendToFile" flag to True in the config
if you want the current contents of the log file not to be erased at
startup of the App:

<appendToFile value="true"/>

-Senthil SS.



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

Sent: Wednesday, November 10, 2004 5:03 PM
To: log4net-user@logging.apache.org
Subject: Problem with RollingFileAppender when restarting application





Hello,

I'm using the log4net1.2.0-beta8 with following configuration for
RollingFileAppender:

     <appender name="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
       <file value="<Dir>\\Log.xml"/>
       <appendToFile value="false"/>
       <rollingStyle value="Size"/>
       <maxSizeRollBackups value="20"/>
       <maximumFileSize value="10MB"/>
       <staticLogFileName value="true"/>
       <countDirection value="1"/>
       <layout type="log4net.Layout.XMLLayout">
          <param name="ConversionPattern" value="%date [%thread]
%-5level %logger [%ndc] - %message%newline"/>
       </layout>
     </appender>

What I'm trying to do is to restrict the file size to 10MByte and a
number of 20, keep a static log file and start with a new file when
restarting application.

Rolling works fine as long the application runs but when restarting it,
the content of the logfile is lost.

Debugging into log4net code showed that logfile is cleaned when calling
DomConfigurator that is done before any logging is startet. Rolling is
done only when logging and the file already is empty.

I call the DOMConfigurator in following way:

      DOMConfigurator.Configure(new FileInfo(log4netConfigFile));

Is this a bug or is there some other way to obtain the desired
behaviour?

In the mailing list archive I could find some similar problem with
RollingFileAppender that has been fixed. Does is have the same reason
and is this one now fixed too? If so, when will it be available?


Thanks to everey body

Magdalena




Reply via email to