本文介绍了TraceSource的Common.Logging的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试采用Common.Login登录我们的应用程序,但是在使用system.diagnostics进行设置时遇到了一些麻烦.它可以直接使用Trace,但不能使用TraceSource.我正在使用 Common.Logging.Simple.TraceLoggerFactoryAdapter .我需要TraceSource的其他适配器吗?

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?

推荐答案

这已经很晚了,但是也许仍然可以帮助您...

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

根据Common.Logging源这里,TraceLoggerFactoryAdapter确实支持配置,使其使用TraceSources. TraceLoggerFactoryAdapter具有一个名为"useTraceSource"的属性(可在app.config文件中配置).如果将其设置为"true",它将导致TraceLoggerFactoryAdapter分配内部使用TraceSource的TraceLogger.请注意,根据Common.Logging文档,此处,未记录"useTraceSource".

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.

因此,您应该能够在app.config的System.Diagnostics部分中配置TraceSources,并通过在以下代码的Common.Logging部分中指定TraceLoggerFactoryAdapter和"useTraceSource"属性来告诉Common.Logging使用这些TraceSource app.config.

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.

祝你好运!

这篇关于TraceSource的Common.Logging的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 23:50