且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

登录使用ELMAH事件日志错误

更新时间:2022-06-09 01:33:51

ELMAH不包括一个事件日志选项。

ELMAH does not include an event log option.

ELMAH错误日志类不是只写;他们还读取日志数据,以便它可以在ELMAH网络界面被显示。此外,ELMAH记录的不仅仅是异常信息更多。它还记录服务器变量,形式收集和必要的信息以再现死亡的黄色屏幕。即使你记录所有这些信息到事件日志将难以阅读为纯文本,并且很难读回以这样的方式,该ELMAH web界面可以使用它。如果你不打算使用ELMAH Web界面那么显然这不是一个问题。

ELMAH error log classes are not write-only; they also read the log data so that it can be displayed in the ELMAH web interface. Additionally, ELMAH logs more than just exception information. It also logs server variables, the form collection, and the information necessary to reproduce the yellow screen of death. Even if you were to log all of this information to the event log it would be difficult to read as plain text, and very difficult to read back in such a way that the ELMAH web interface could use it. If you are not going to use the ELMAH web interface then clearly that is not an issue.

如果您想记录基本的异常数据到事件日志中,您可以通过继承错误日志创建自己的错误日志。 ELMAH支持多种错误日志,所以你可以继续详细的数据记录到XML或数据库(以服务ELMAH Web界面),然后记录该数据的一个子集到事件日志。

If you want to log basic exception data to the event log you can create your own error log by subclassing ErrorLog. ELMAH supports multiple error logs, so you could continue to log detailed data to XML or a database (to service the ELMAH web interface) and then log a subset of that data to the event log.