如何在asp.net应用程序IIS中进行日志记录?
我有一个大约 2 年前编写的 ASP.NET Web 应用程序。它没有任何日志记录机制。理想情况下,我想记录发生的任何错误,特别是在数据库级别。然而,我不能破坏应用程序,而且我的时间有限。
我听说过ELMAH。是否有可能有一些东西不直接与我的代码对话,而只是通过监视服务器来完成自己的事情?
- 它是用 ASP.NET 3.5 制作的。
- 它具有 AJAX 以及大量使用 ViewState。
- 该应用程序还与 Excel 进行通信。
- 它是在 Visual Studio 2008 中构建的,后端带有 SQL Server 2005。
我该如何部署满足上述要求的网站?
i have a asp.net web application written about 2 years ago .It does not have any logging mechanism in it. Ideally I would like to log any errors that happen especially at the database level. I cannot afford to break the application however, and I have limited time.
I have heard about ELMAH. Is it possible to have something that doesn't talk to my code directly and just does its own thing by monitoring the server?
- It was made in ASP.NET 3.5.
- It has AJAX as well as heavy use of ViewState.
- The application also communicates with Excel.
- It is built in Visual Studio 2008 w/ SQL Server 2005 on the backend.
How do I go about deploying this website with above requirements?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的。
将 ELAMH 添加到您的应用程序 - 它将记录错误。它是非侵入性的。
一旦 ELMAH 添加到您的应用程序中,它就会挂钩 OnError 事件并捕获应用程序抛出的所有错误。这是假设您的应用程序不会吞掉错误。
有关 ELMAH 的文档十分详尽且易于理解。
Yes.
Added ELAMH to your application - it will log the errors. It's non-invasive.
Once ELMAH is added to your application it hooks into the OnError Event and captures all errors throw by your application. This is assuming that your application does not swallow the errors.
The documentation around ELMAH is through and easy to follow.
还有 log4net -
http://logging.apache.org/log4net/
There is also log4net -
http://logging.apache.org/log4net/