Maximum Elmah Log Entries

I am storing the exceptions thrown by Elmah as XML files.

Is there a way to set it up so that it automatically deletes files older than X days? Or perhaps the maximum number of files in a directory? Or do I need to create my own batch job that does this?

+3


source to share


1 answer


From the Elmah project site for ErrorLogImplementations , (Italics added for emphasis)

XmlErrorLog

XmlFileErrorLog stores errors in orphaned XML files in a custom directory. Each bug gets its own file containing all its details. The files can be easily copied, deleted, compressed, or sent to someone else for further diagnosis. It does not require any mechanism or database setup, such as with SQL Server and Oracle, so there is very little overhead and you don’t need to worry about the additional costs associated with hosting plans. Although simple, it relies on the performance of the filesystem to shred through a directory, read files, and sort through them. The clever XmlFileErrorLog based logging method works smoothly: limiting the number of files by scheduling a task to periodically archive old logs and clean up the folder.



You will need to create your own batch job to do this.

+7


source







All Articles