日志记录ASP.NET - 最佳实践 [英] Logging for ASP.NET - Best Practices

查看:96
本文介绍了日志记录ASP.NET - 最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是在ASP.NET 2.0的网页或Web服务来写最小的错误日志的最佳方式?对于我而言这将会是最好的,如果这是香草,以及实施将通过IIS虚拟目录工作。我目前使用的标准TextWriterTraceListener会,但似乎并没有写入到虚拟目录。

What is the best way to write minimal error logs in an ASP.NET 2.0 web page or web service? For my purposes it'd be best if this was vanilla, and the implementation would work through IIS's virtual directories. I'm currently using the standard TextWriterTraceListener, but it doesn't seem to write to the virtual directory.

仅供参考 - 在TextWriterTraceListener会配置如下:

FYI - the TextWriterTraceListener's configuration follows:

<system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData=".\VirtualDirectory\SomeLog.log" />
      </listeners>
    </trace>
  </system.diagnostics>

我AP preciate您的帮助!

I appreciate your help!

推荐答案

您可以尝试log4net的框架。这是非常强大的开源.NET日志框架。看看 log4net的网站

You could try log4net framework. It is very powerfull open-source .NET logging framework. Take a look at Log4net web site

这篇关于日志记录ASP.NET - 最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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