问题描述
我已经开始了内置TraceSource和TraceListener的类,我想修改独立于TraceSources和TraceListeners事件的输出格式。看来,TraceListeners应用自己的格式。是否有可能完全改变格式,而不为每个TraceListener的我用创建一个新的类?
I've begun to the the built-in TraceSource and TraceListener classes and I would like to modify the output format of the events independently of the TraceSources and TraceListeners. It seems that the TraceListeners apply their own formatting. Is it possible to completely change the formatting without creating a new class for each and every TraceListener I use?
推荐答案
企业库日志应用程序块(http://msdn.microsoft.com/en-us/library/cc309506.aspx)是建立在.NET TraceSource和TraceListener的类(这样你就可以pretty的简单,只是把它放到你的项目,它会工作),并支持一些可以在web.config配置消息格式(或应用程序的.config)。
The Enterprise Library Logging Application Block (http://msdn.microsoft.com/en-us/library/cc309506.aspx) is built on the .Net TraceSource and TraceListener classes (so you can pretty much just drop it into your project and it'll work), and it supports a message formatter that you can configure in the web.config (or app.config).
这篇关于请问净TraceSource / TraceListener的框架有类似的log4net的格式化程序的东西吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!