ELMAH日志文件删除,请手动或者是有一个设置? [英] Elmah log files deletion, manually or is there a setting?

查看:809
本文介绍了ELMAH日志文件删除,请手动或者是有一个设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何删除ELMAH生成服务器上的日志文件?

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

有内ELMAH的设置,我可以用它来删除日志文件?我想preFER指定一些标准(如日志都超过30天的文件)。

Is there a setting within Elmah that I can use to delete log files? I would prefer to specify some criteria (e.g. log files that are older than 30 days).

或者我应该写我自己的code是什么?

Or should I write my own code for that ?

推荐答案

您可以设置日志条目的最大数量,但没有清除出大于给定日期的日志的本地函数。这是一个很好的功能要求,但!

You can set the maximum number of log entries, but there isn't a native function for clearing out logs older than a given date. It's a good feature request, though!

如果你是存储在内存中的错误日志存储的最大数量为500默认情况下,这需要额外的配置。另外,您可以定义使用尺寸关键字数:

If you are storing your error logs in memory the maximum number stored is 500 by default and this requires no additional configuration. Alternatively, you can define the number using the size keyword:

<elmah>  
  <errorLog type="Elmah.MemoryErrorLog, Elmah" size="50" />  
</elmah>

设置固定的大小显然更为重要的内存或基于XML的日志记录,其中资源需要严格的管理。您可以定义一个固定大小虽然任何日志类型。

Setting a fixed size is obviously more important for in-memory or XML-based logging, where resources need to be closely managed. You can define a fixed size for any log type though.

这篇关于ELMAH日志文件删除,请手动或者是有一个设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆