开发者

StackOverflowException with Common.Logging and Common.Logging.Simple.CommonLoggingTraceListener

I'm trying to redirect all log messages from System.Diagnostics.Trace to Common.Logging as documented on the Common.Logging website.

Unfortunately when I run my application I get a StackOverflowException and I'm not sure why. If I delete the <system.diagnostics> section it runs fine.

I've replicated this problem using a simple Console application which makes a single call to Trace.WriteLine("hello");

Here's my complete App.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.diagnostics>
    <trace>
      <listeners>
        <clear />
        <add name="commonLoggingListener"
             type="Common.Logging.Simple.CommonLoggingTraceListener, Common.Logging"
             initializeData开发者_JAVA百科="LogLevel=Trace" />
      </listeners>
    </trace>
  </system.diagnostics>
</configuration>

Can anyone make any suggestions as to what is causing the StackOverflowException?


I've moved on from this issue now, but I think the answer from CodeMonkeyKing is probably accurate:

I'm sure that you've figured this out by now but I don't see any answers. One of the most common causes for a StackOverflowException is if you are making use of the Trace listener for Common Logging. It would make sense that if you redirect all of .Diag'ics.Trace to Common.Logging that you could end up with a overflow depending on which logging factory adapter you've configured.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜