You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by da...@o-i.com on 2009/02/04 15:40:26 UTC

RollingFileAppender behavior on program exit

Hi,
I am using log4net 1.2.10 RollingFileAppender in C#/VS2005.  Rolling the files by date.  Everything is
working fine except that the final log file written before program exit is not rolled and remains named
as a temp file (just the name as specified in file value without the date pattern and extension).  I am
calling the Shutdown function, but this does not seem to help.  Attached is the .config xml I'm currently
using.  Its set to rollover on minute boundaries as a debugging convenience.  Some of the tags may be
extraneous, I've been trying a few different strategies for dealing with this...
As an additional layer of complexity, I'm actually using this from VB6/COM.  My C# code is just a
ComVisible wrapper to the basic log4net calls.
Any input would be appreciated.  This is starting to drive me nuts.

Regards,

Dan


Re: RollingFileAppender behavior on program exit

Posted by da...@o-i.com.
arg...
Here is the xml I promised:

<?xml version="1.0" encoding="utf-8" ?>

<configuration>
  <!-- Register a section handler for the log4net section -->
  <configSections>
    <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
  </configSections>

  <appSettings>
    <!-- To enable internal log4net logging specify the following appSettings key -->
    <!-- <add key="log4net.Internal.Debug" value="true"/> -->
  </appSettings>

  <!-- This section contains the log4net configuration settings -->
  <log4net>
    <appender name="MinuteRollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
      <file value="C:\OIApps\Interactive\MSDiagnostics\MSDLog" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <datePattern value="HHmm.lo\g" />
      <lockingModel       type="log4net.Appender.FileAppender+MinimalLock" />
      <bufferSize value="0" />
      <ImmediateFlush value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"
/>
      </layout>
    </appender>

    <root>
      <level value="ALL" />
      <appender-ref ref="MinuteRollingLogFileAppender" />
    </root>

  </log4net>
</configuration>


                                                                                                         
             daniel.nitecki@o-i.com                                                                      
                                                                                                         
             02/04/2009 09:40 AM                                                                      To 
                                                   log4net-user@logging.apache.org                       
                                                                                                      cc 
                   Please respond to                                                                     
                    "Log4NET User"                                                               Subject 
             <log4net-user@logging.apache.         RollingFileAppender behavior on program exit          
                         org>                                                                            
                                                                                                         
                                                                                                         
                                                                                                         
                                                                                                         
                                                                                                         





Hi,
I am using log4net 1.2.10 RollingFileAppender in C#/VS2005.  Rolling the files by date.  Everything is
working fine except that the final log file written before program exit is not rolled and remains named
as a temp file (just the name as specified in file value without the date pattern and extension).  I am
calling the Shutdown function, but this does not seem to help.  Attached is the .config xml I'm currently
using.  Its set to rollover on minute boundaries as a debugging convenience.  Some of the tags may be
extraneous, I've been trying a few different strategies for dealing with this...
As an additional layer of complexity, I'm actually using this from VB6/COM.  My C# code is just a
ComVisible wrapper to the basic log4net calls.
Any input would be appreciated.  This is starting to drive me nuts.

Regards,

Dan