logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shaily Goel" <gsha...@novell.com>
Subject RE: DatePatterns in RollingFileAppender
Date Thu, 18 Aug 2005 05:12:09 GMT
hi
 
Thanks for a quick reply.  I am facing the following problems regarding
the use of DatePattern in RollingFileAppender:
 
1. I used DatePattern as "yyyy-MM" to Roll at the beginning of each
month like below:
 
           RollingFileAppender appender = new RollingFileAppender();
            SimpleLayout layOut = new SimpleLayout();
            appender.Name = "CustomRoller";
            appender.File = <FullPathTo File>
            appender.AppendToFile = true;           
            appender.RollingStyle =
RollingFileAppender.RollingMode.Date;
            appender.DatePattern = "yyyy-MM";
            appender.Layout = layOut;
            appender.ActivateOptions();   
 
I found that RollingFileAppender does not identify this pattern.
RollingfileAppender.ComputeCheckPeriod() returns
"RollPoint.TopOfTrouble" when I passed the above DatePattern.
 
Can you please let me know what DatePattern I should use to roll the
log each month(RollPoint.TopOfMonth)
 
2. I am unable to identify the DatePattern that I should use to roll
the log each week(RollPoint.TopOfWeek). Please let me know by example
the DatePattern I should use for rolling the log each week. If
"RollPoint.TopOfWeek" option is used then at which day of the week the
rolling will take place . Is it the first day of the week, which can be
different depending on the locale or the last day of the week or some
defined day only??
 
Thanks
Shaily


 

>>> nicko@neoworks.com 08/17/05 5:28 PM >>>



> -----Original Message-----
> From: Shaily Goel [mailto:gshaily@novell.com] 
> Sent: 17 August 2005 11:52
> To: log4net-user@logging.apache.org
> Subject: DatePatterns in RollingFileAppender
> 
> Hi
>  
> I am using RollingFileAppender to log the messages. The 
> RollingFileAppender should roll the files based on Date. For 
> this, I need to set "DatePattern" property of 
> RollingFileAppender. I am not able to find the correct 
> DatePatterns that should be used for following. Please give 
> me the examples that what date patterns should  I use for following:

The RollingFileAppender uses DateTime.ToString(pattern) to convert the
date to a string.
See http://msdn2.microsoft.com/library/8kb3ddd4(en-us,vs.80).aspx for
details of the pattern specifiers.


> 1.  Rollover at the beginning of each month 

yyyy-MM


> 2.  Rollover at the first day of each week. 
>     The first day of the week depends on the locale.

not possible, no date pattern for day of week


> 3.  Rollover at midnight each day

yyyy-MM-dd


> 4.  Rollover at midnight and midday of each day 

yyyy-MM-ddt


> 5.  Rollover at the top of every hour

yyyy-MM-dd-HH


> 6.  Rollover at the beginning of every minute

yyyy-MM-dd-HH-mm


>  
> Thanks
> Shaily
>  
>  
> 


Mime
View raw message