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

2
  • 1
    " it just happens totally random" - I'm fairly certain it's not actually random..>>! Jul 30, 2014 at 8:27
  • can work for days can work for minutes, the rolling does work until it's getting stuck
    – atikot
    Jul 30, 2014 at 8:28

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.