Delete th old log files

Topics: Logging Application Block
May 21, 2007 at 7:24 PM
There is option to delete th old log files in Enterprise Library?
When i use in Rolling Flat the ,log files accumulate .and
i want to delete the old files.
May 21, 2007 at 8:11 PM
As far as I can see there is no such option in the rolling flat file trace listener which comes with EntLib 3.0.
I think you can add this option manually extending this listener by implementing a new one and deriving from rolling flat file listener.

Btw with EntLib 2.0 we used a free 3rd party listener developed by Ervyn van der Meer (http://bloggingabout.net/blogs/erwyn/articles/rollingfiletrace_listener.aspx)
I guess it can be recompiled using EntLib 3.0

-
Leonid
May 22, 2007 at 2:00 AM
If you only want to maintain 1 file, you can of course just change the RollFileExistsBehavior to Overwrite instead of Increment.

However, if you want the ability to specify only keep 5 days worth of files and then start overwriting, there is no such option. I really wish there was, but you can always use a Service or Powershell to help with such administrative tasks.

Regards,

Dave

____________________________________

David Hayden
Microsoft MVP C#
May 24, 2007 at 6:55 AM
I really think that this feature should be integrated in the trace listener, as setting upp administrative tasks for this takes up to much time in each installation and has a high risk of beeing forgotten, ending up filling the disk.
May 24, 2007 at 9:36 AM
I guess this could be an architectural suggestion to the next version of EntLib - make Listener's Behaviors configurable through config file.

-
Leonid
May 24, 2007 at 2:14 PM
Lani78,

I agree. It should be a part of the TraceListener.

If it is not there already, I recommend adding it to the IssueTracker just so it gets documented.

Regards,

Dave

_______________________________

David Hayden
Microsoft MVP C#