Setting the StaticLogFileName property to true means that the current
file will be called 'CAPS_DMS.log' and will be renamed when the rolling
period is up. If StaticLogFileName is false then the current file will
already be named with the start of the date range period.

If the file is being overwritten rather than rolled at the date boundary
then it is likely that the app does not have permission to rename the
file. You should run with log4net internal debug enabled to see any
error messages that log4net encounters.

http://logging.apache.org/log4net/release/faq.html#internalDebug

Nicko

> -----Original Message-----
> From: Matthew Brown [mailto:[EMAIL PROTECTED] 
> Sent: 15 November 2005 13:24
> To: Log4NET User
> Subject: Re: RollingFileAppender truncates logfile at midnight
> 
> You should remove <StaticLogFileName value="true" /> . I 
> think the documentation might be a little confusing, but in 
> my experience, under this setting the RollingFileAppender 
> will only write to that one file, and not make any backups.
> 
> 
> On 11/15/05, Moss, Barney <[EMAIL PROTECTED]> wrote:
> 
>       I use the RollingFileAppender to write a logfile from a 
> long-lived process.
>       It is configured with static logfile name and to roll by date:
>       
>                       <appender name="LogfileAppender" 
> type="log4net.Appender.RollingFileAppender">
>                               <file  value="logs\\CAPS_DMS.log" />
>                               <RollingStyle value="date" />
>                               <StaticLogFileName value="true" />
>                               <MaxSizeRollBackups value="10" />
>                               <lockingModel 
> type="log4net.Appender.FileAppender+MinimalLock" />
>                               <layout 
> type="log4net.Layout.PatternLayout">
>                                       <param 
> name="ConversionPattern" value="%d [%t] %-5p %c{1} - %m%n" />
>                               </layout>
>                               <filter 
> type="log4net.Filter.LevelRangeFilter">
>                                       <param name="LevelMin" 
> value="DEBUG" />
>                               </filter>
>                               <filter 
> type="log4net.Filter.DenyAllFilter" />
>                       </appender>
>       
>       The problem is that if the process happens to run over 
> midnight (e.g. starts at 11pm, runs for 2 hours), the first 
> message after midnight causes the logfile to be truncated 
> without being renamed first.  The first message in the file 
> is from just past midnight.
>       
>       Is this a known bug?  I didn't find anything in the 
> mail list archives.
>       -thanks, Barney Moss
>       
>       
> ==============================================================
> ================
>       Please access the attached hyperlink for an important 
> electronic communications disclaimer: 
>       
>       http://www.csfb.com/legal_terms/disclaimer_external_email.shtml
>       
>       
> ==============================================================
> ================ 
>       
>       
> 
> 
> 

Reply via email to