从ASP.NET应用程序写入IIS日志 [英] write to IIS log from an ASP.NET application

查看:547
本文介绍了从ASP.NET应用程序写入IIS日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让我的ASP.NET应用程序将行写入某个日志。 IIS是否提供了记录ASP.NET日志消息的任何内置方法?我想可能有办法捕获对System.Diagnostics.Debug.WriteLine()的调用,但我找不到任何办法。

I want to have my ASP.NET application write lines to a log somewhere. Does IIS provide any built-in way to log ASP.NET log messages? I was thinking there might be a way to capture calls to System.Diagnostics.Debug.WriteLine(), but I can't find any way to do it.

推荐答案

要捕获 Debug.Write Debug.WriteLine 使用的http://technet.microsoft.com/en-us/sysinternals/bb896647\"rel =noreferrer> DebugView

http://technet.microsoft.com/en-us/sysinternals / bb896647

当然你必须用 Debug = true 编译,否则函数不是完全叫了。所以 Debug.Write是一个很好的方法,只能实时测试和调试你的应用程序,而不是一般的记录错误的解决方案。对于您希望保存错误的情况,我认为您需要使用其他用户建议的一个库,或直接在事件查看器上写下您的错误。

Of course you have to compile with Debug=true or else the functions is not called at all. So the Debug.Write is a good way only for test in real time and debug your application and not a solution to keep log on the errors in general. For the case that you like to save the errors I think that you need to ether use one library of the other user suggestions, or write direct on event viewer your errors.

ps:由于某种原因版本4.78无法在我的Windows XP上运行,我切换回4.77

这篇关于从ASP.NET应用程序写入IIS日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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