How does one troubleshoot log4net when it stops logging

后端 未结 3 840
悲&欢浪女
悲&欢浪女 2020-12-24 08:11

It seems that Log4Net silently shuts down for reasons that are not obvious, and I\'m at a loss how to troubleshoot it. My hunch is that a particular appender is failing on

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-24 09:01

    I was having a tough time figuring out why the file log and sql log appenders were not working. I had changed the default SQL table and it turns out that the data type Int was no good and Int32 was the correct value. I couldn't seem to find this information until I was debugging in Visual Studio and stepped into the logging method. Execution of the method was paused on my breakpoint and I ran the setup command in the Immediate Window:

    log4net.Config.XmlConfigurator.Configure()

    I was able to see immediate feedback and there was in-fact an exception thrown when that configuration code ran. It displayed in the Immediate Window and I was able to address the issue.

    Hopefully this helps somebody.

提交回复
热议问题