LogByDate with a maximum number of files?

CodeSite logging interface classes: default "CodeSite" logger, T|CodeSiteLogger class, destinations, formatters, etc.

LogByDate with a maximum number of files?

Postby cdelasablonniere » Wed Dec 21, 2011 3:35 pm

Hi,
I am thinking about using the LogFileDestination.LogByDate property to create one log file per day.

Is there a way to automatically delete the oldest log files? Something similar to what MaxPart is doing?



TIA

Charles
cdelasablonniere
 
Posts: 3
Joined:
Wed Dec 21, 2011 3:20 pm

Re: LogByDate with a maximum number of files?

Postby Raize Support » Wed Dec 21, 2011 6:18 pm

Hi Charles,

Do you mean something like a MaxDays property? Such that any log files that are older than today minus MaxDays would get deleted.

This functionality is not available, but it is an interesting idea. Of course, as a workaround, you could always delete the older log files yourself when your app starts or at some predetermined time.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 610
Joined:
Fri Mar 25, 2011 9:04 pm

Re: LogByDate with a maximum number of files?

Postby cdelasablonniere » Fri Dec 23, 2011 9:53 am

Hi Ray,
this is exactly what I mean. A MaxDays property or some king of mechanism that would ensure that no matter how many log files I have, they never exceed "X" size on disk.

I know we could implement something in our code that would delete older files at start-up, but having it done automatically would help me convince my management to buy licences for all our development staff.


Charles
cdelasablonniere
 
Posts: 3
Joined:
Wed Dec 21, 2011 3:20 pm

Re: LogByDate with a maximum number of files?

Postby Raize Support » Sat Dec 24, 2011 2:44 am

Well, I'm not sure if MaxDays would actually enforce your statement "that no matter how many log files I have, they never exceed "X" size on disk."

A MaxDays setting would only make sense if LogByDate was also set. And then the MaxDays setting would control how many day logs you would keep around. However, it would not control the size of those individual day logs.

Currently, you control the amount of logging information that is kept around by using the MaxParts and MaxSize properties. For example, you can setup the MaxSize to be 1024, which is 1024 K, and then the MaxParts value to 5, and this would put a cap on the logging data to be 5 MB. For more details about the LogFile settings, please see the CS5 Help.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 610
Joined:
Fri Mar 25, 2011 9:04 pm


Return to Loggers

Who is online

Users browsing this forum: No registered users and 1 guest