logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Means <eric.me...@gmail.com>
Subject Re: Using RollingFileAppender
Date Wed, 08 Dec 2004 19:03:00 GMT
I don't think you can do this in log4net unless you implement your own appender.

You could use the RollingFileAppender with appendtofile=true and set
up a recurring Scheduled Task that deletes the file created 7 days ago
(runs every day at midnight).

On Wed, 08 Dec 2004 09:34:03 -0600, Shrivastava, Ravi
<ravi.shrivastava@bankofamerica.com> wrote:
> I have tried that but it seems to either overwrite the logs
> (appendtofile=false) if I run the app multiple times during the same day or
> keeps appending to the file (appendtofile=true) even after 1 week has gone
> by. Keep in mind I want to have a week worth of logs - come next Monday, for
> ex, and I'd like to start a new Monday.log file.
> -----Original Message-----
> From: Andrew Elmhorst [mailto:nospam@elmhorst.com]
> Sent: Wednesday, December 08, 2004 9:14 AM
> To: 'Log4NET User'
> Subject: RE: Using RollingFileAppender
> Try setting the DatePattern property on the RollingFileAppender to
> "'.'dddd'.log'"
> This should create backup log files in the pattern [logfilename].Monday.log.
> This should get you close to what you want. You can also set the
> StaticLogFileName to false and the RollingFileAppender should write directly
> to [logfilename].Monday.log.
> Regards,
> Andrew Elmhorst
> -----Original Message-----
> From: Shrivastava, Ravi [mailto:ravi.shrivastava@bankofamerica.com]
> Sent: Wednesday, December 08, 2004 7:56 AM
> To: 'Log4NET User'
> Subject: Using RollingFileAppender
> Is there a way I can configure RollingFileAppender to create a log file per
> day, append to it if it's the app is run multiple times during that same
> day, but overwrite it the following week. Ex: Have Monday.log,
> Tuesday.log....etc., which show me logged activity for all of that day - on
> the following Monday, Tues....they get overwritten.
> TIA.

Eric Means

View raw message