log4net FileAppender System.ObjectDisposedException

时间:2015-03-27 17:18:30

标签: c# .net multithreading log4net

我在一个小型控制台应用程序中使用log4net,该应用程序由另一个应用程序以某种shell方式启动。我发现的是,每次关闭应用程序时都会崩溃,并且从查看堆栈跟踪看起来似乎log4net正在等待解除线程锁定,但是当它执行时手动重置事件是已经处理好了我已经尝试订阅ILog.Logger.Repository.ShutdownEvent来延迟关闭应用程序,直到log4net清理了它的资源,但我仍然可以使用这些检查重现错误。有什么想法吗?

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ObjectDisposedException
Stack: at System.Threading.WaitHandle.WaitOneNative(System.Runtime.InteropServices.SafeHandle, UInt32, Boolean, Boolean)
at System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle, Int64, Boolean, Boolean)
at System.Threading.WaitHandle.WaitOne(Int32, Boolean)
at System.Threading.WaitHandle.WaitOne()
at log4net.Appender.FileAppender+InterProcessLock.AcquireLock()
at log4net.Appender.FileAppender+LockingStream.AcquireLock()
at log4net.Appender.FileAppender.WriteFooter()
at log4net.Appender.TextWriterAppender.WriteFooterAndCloseWriter()
at log4net.Appender.FileAppender.Reset()
at log4net.Appender.TextWriterAppender.OnClose()
at log4net.Appender.AppenderSkeleton.Close()
at log4net.Appender.AppenderSkeleton.Finalize()

0 个答案:

没有答案