Common.Logging for TraceSource

为君一笑 提交于 2020-01-13 16:26:10

问题


I am trying to adopt Common.Logging in our application, however I am having some trouble setting it up with system.diagnostics. It works with straight up Trace, but not TraceSource. I was using Common.Logging.Simple.TraceLoggerFactoryAdapter. Do i need a different adapter for TraceSource?


回答1:


This is pretty late, but maybe it will still help you...

According to the Common.Logging source here, the TraceLoggerFactoryAdapter does support configuring such that it uses TraceSources. The TraceLoggerFactoryAdapter has a property (that is configurable in app.config file) called "useTraceSource". If that is set to "true", it should cause the TraceLoggerFactoryAdapter to dispense TraceLoggers that use a TraceSource internally. Note that according to the Common.Logging documentation here, "useTraceSource" is not documented.

So, you should be able to configure your TraceSources in the System.Diagnostics section of your app.config and tell Common.Logging to use those TraceSources by specifying the TraceLoggerFactoryAdapter and the "useTraceSource" property in the Common.Logging section of the app.config.

Good luck!



来源:https://stackoverflow.com/questions/9847401/common-logging-for-tracesource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!