When I run some integration tests via NUnit, everything works, including logging. When I run any test a second time, no exception is thrown, but logging ceases to work. Instead, log4net writes this to the console:
log4net:ERROR [TextWriterAppender] Attempted to append to closed appender named [].
Here is the log4net configuration:
  <log4net debug="true" >
    <appender name="console"
          type="log4net.Appender.ConsoleAppender, log4net">
      <layout type="log4net.Layout.PatternLayout,log4net">
        <param name="ConversionPattern"
             value="%d{ABSOLUTE} %-5p %c{1}:%L - %m%n" />
      </layout>
    </appender>
    <root>
      <priority value="DEBUG" />
      <appender-ref ref="console" />
    </root>
    <logger name="NHibernate">
      <level value="WARN" />
    </logger>
    <logger name="NHibernate.SQL" >
      <level value="DEBUG" />
    </logger>
  </log4net>
The setup code is in a static constructor in the SUT:
log4net.Config.XmlConfigurator.Configure();
I managed to get the same error with a variety of other appender settings. What causes this error? I want to know what the cause is so I know how to fix it, and also how to reproduce this in a production scenario (if that is possible) so I can keep it from happening to production code.
I am using NHibernate 2.0.1.GA and the log4net version that comes with it (1.2.10.0).
Well if you look at the error it says [TextWriterAppender] this means log4net is trying to to append the log message to a TextWriter whereas the config which you gave doesn't have any.
Either there is another config file with a log4net tag being loaded or in code you are anywhere calling up LogManager.Shutdown()
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论