并附上自定义值从IIS日志ASP.NET [英] Append custom value to IIS logs from ASP.NET
问题描述
我只是想追加其在运行时产生的页面为当前请求(或作为替代,覆盖标准的领域之一,我的自定义值)我的IIS日志项的附加价值。
I would simply like to append an additional value which is generated at runtime in a page to my IIS log entry for the current request (or as an alternative, overwrite one of the standard fields with my custom value).
我无法找到一个方法来做到这一点,我无法找到C#编写自定义日志处理程序的一个例子(我不精通С++)
I can't find a way to do this and I can't find an example of writing a custom log handler in C# (I'm not proficient in С++)
任何帮助是AP preciated,谢谢。
Any help is appreciated, thanks.
推荐答案
如果您正在使用IIS 7.x的,你可以这样使用的高级日志扩展。
If you were using IIS 7.x you could achieve this using the Advanced Logging extension.
使用这个你可以从许多不同来源的资料来源自定义字段的数据。有一篇文章就在这里设置此功能:
Using this you can source data from custom fields from a number of different sources. There's an article on setting this up here:
在IIS6你需要实现自己的自定义记录器,我不认为有一种方法来拦截事件记录到默认日志(iislog.dll),并添加额外的数据:
In IIS6 you'd need to implement your own custom logger, I don't think there's a way to intercept logging events to the default logger (iislog.dll) and add extra data:
您记录很可能也必须用C ++编写的IIS6,除非你能要挟.NET运行时COM包装组件内加载。
Your logger would probably also have to be written in C++ for IIS6 unless you could coerce the .NET runtime to load inside a COM wrapper component.
这篇关于并附上自定义值从IIS日志ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!