0

I get the following message in the eventlog for my service:

Exception: System.NullReferenceException

Message: Object reference not set to an instance of an object.

StackTrace:
   at log4net.Appender.RollingFileAppender.AdjustFileBeforeAppend() in C:\Projects\Framework\log4net-1.2.11\src\Appender\RollingFileAppender.cs:line 609
   at log4net.Appender.RollingFileAppender.Append(LoggingEvent loggingEvent) in C:\Projects\Framework\log4net-1.2.11\src\Appender\RollingFileAppender.cs:line 562
   at LSports.Common.Logger.Appenders.AsynchronousFileAppender.LogMessages() in d:\tfsV3\Dev\Common\Logger\LSports.Common.Logger\Appenders\AsynchronousFileAppender .cs:line 63
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

I use the log4net in more projects in the system beside the webservice and it just getting randomly stuck there too.

I looked in source file of log4net where the exception occurs and it happens when it tries to perform file rolling

    if (m_rollSize) 
        {
            /* this line*/ if ((File != null) && ((CountingQuietTextWriter)QuietWriter).Count >= m_maxFileSize) 
            {
                RollOverSize();
            }
        }

what could be causing this? it just happens totally random

atikot
  • 4,761
  • 4
  • 26
  • 34

1 Answers1

0

After a lot of searching i finally found the problem, the log4net actually hangs because it tries to print error to console, and my application is hidden so it fails to print to the console and just stops the thread that called the log4net.

atikot
  • 4,761
  • 4
  • 26
  • 34