Elmah log files deletion, manually or is there a setting?

前端 未结 4 1690
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-12 13:35

How do I delete the log files that Elmah generates on the server?

Is there a setting within Elmah that I can use to delete log files? I would prefer to specify some cr

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-12 14:22

    In response to what Phil Wheeler mentioned above, on a current project I am doing in Mvc4, we have an Mvc area called SiteAdmin. This area will be responsible for all site administration duties, including Elmah.

    To get over the lack of delete functionality, I implemented a function to delete all of the current log entries in Elmah (we're using the XML based version).

    Here is an image of the SiteAdmin index view:

    enter image description here

    • View Error Log - Opens the Elmah UI in a new window.
    • Clear Error Log - Presents a confirmation popup, then deletes all entries if the user confirms.

    If anyone needs the code as an example, I'd be happy to send it along.

    My mechanics could be modified pretty easily to provide a mechanism for selective deletions by criteria if needed (by date, by status code, etc...).

    The point of my answer here is that you could provide the delete functionality on your own AND not fork the open source code of the Elmah project.

提交回复
热议问题