ASP.NET web application using log4net results in a first chance exception of 
type 'System.Threading.ThreadAbortException' 
--------------------------------------------------------------------------------------------------------------------------

                 Key: LOG4NET-121
                 URL: https://issues.apache.org/jira/browse/LOG4NET-121
             Project: Log4net
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.2.9
         Environment: Windows XP Professional running Visual Studio .NET 2003
            Reporter: HJ


I have created a simple ASP.NET webapplication that just prints a statement to 
a log file. I ran this web application in Visual Studio debugger and the 
application crashes on the log statement with error message shown below. I use 
a seperate configuration file to configure log4net for my application as I 
don't want to use web.config or applicationName.exe.config file and want to 
stick to a seperate log configuration file. Attached below is the log config 
file that I'm using and the snippet of C# code that I'm using to initialize 
logger. I have given ASPNET user full permissions on "D:\Logs" directory.

I will appreciate your early help.


Log configuration file:
-----------------------------------
<?xml version="1.0" encoding="utf-8" ?> 
<!-- .NET Application configuration file -->

<configuration>

        <!-- Register the section handler for the log4net section -->
        <configSections>
                <section name="log4net" 
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
        </configSections>

        <!-- Enable internal debugging in log4net -->
        <appSettings>
                <!-- To enable internal log4net logging specify the 
                     following appSettings key -->
                     
                <!-- <add key="log4net.Internal.Debug" value="true"/> -->
                
        </appSettings>

        
        <log4net>

                <appender name="RollingFileAppender" 
type="log4net.Appender.RollingFileAppender">

                        
                                <param name="File" value="D:\Logs\logfile.txt" 
/>

                        <param name="AppendToFile" value="true" />

                        <param name="MaxSizeRollBackups" value="15" />

                        <param name="MaximumFileSize" value="10000000" />

                        <param name="RollingStyle" value="Size" />

                        <!-- evaluator type="log4net.spi.LevelEvaluator">

                                <threshold value="DEBUG"/>

                        </evaluator -->

                        <layout type="log4net.Layout.PatternLayout">

                                <param name="ConversionPattern" value="%d 
[%t]%-5p [%c] - %m%n" />

                        </layout>

                </appender>

                <root>

                        <priority value="DEBUG" />

                </root>


                <logger name="TestLogger">

                        <level value="DEBUG" />

                                <appender-ref ref="RollingFileAppender" />
                                
                </logger>

    </log4net>

</configuration>

-------------------------------



C# code sample showing how I intialize the logger:
------------------------------------------------------------------

public class MySample
{
      private static readonly log4net.ILog m_log = 
log4net.LogManager.GetLogger("TestLogger");

      public void InitializeLogger()
     {
           
log4net.Config.XmlConfigurator.ConfigureAndWatch(m_LoggerConfigFileLocation);
           m_log.Info("Logging to the file");
     }
     
}

-------------------------------------------




Debug Output error message in Visual Studio .net 2003:
----------------------------------------------------------------------------------
A first chance exception of type 'System.Threading.ThreadAbortException' 
occurred in mscorlib.dll

Additional information: Thread was being aborted.

The program '[5232] aspnet_wp.exe: DefaultDomain' has exited with code 0 (0x0).


Callstack:
--------------------------------
>       mscorlib.dll!System.UnloadThreadWorker.Unload(System.AppDomain domain) 
> + 0x126 bytes    
        mscorlib.dll!System.UnloadWorker.Unload(System.AppDomain domain) + 0x65 
bytes   
        
mscorlib.dll!System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage
 msg, int methodPtr, bool fExecuteInContext) + 0x30b bytes 
        
mscorlib.dll!System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage
 msg) + 0x9 bytes  
        
mscorlib.dll!System.Runtime.Remoting.Messaging.ServerObjectTerminatorSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage
 reqMsg) + 0x12c bytes   
        
mscorlib.dll!System.Runtime.Remoting.Messaging.ServerContextTerminatorSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage
 reqMsg) + 0x1b3 bytes  
        
mscorlib.dll!System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage
 reqMsg) + 0x209 bytes   
        
mscorlib.dll!System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(System.Runtime.Remoting.Messaging.IMessage
 msg) + 0xe6 bytes  
        
mscorlib.dll!System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(byte[]
 reqStmBuff, System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage 
smuggledMcm, System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage 
smuggledMrm) + 0x70 bytes 
        
mscorlib.dll!System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatch(byte[]
 reqStmBuff, System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage 
smuggledMcm, System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage 
smuggledMrm) + 0x6e bytes       
        
mscorlib.dll!System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage
 reqMsg) + 0x1e1 bytes    
        
mscorlib.dll!System.Runtime.Remoting.Proxies.RemotingProxy.CallProcessMessage(System.Runtime.Remoting.Messaging.IMessageSink
 ms, System.Runtime.Remoting.Messaging.IMessage reqMsg, 
System.Runtime.Remoting.Contexts.ArrayWithSize proxySinks, 
System.Threading.Thread currentThread, System.Runtime.Remoting.Contexts.Context 
currentContext, bool bSkippingContextChain) + 0x62 bytes 
        
mscorlib.dll!System.Runtime.Remoting.Proxies.RemotingProxy.InternalInvoke(System.Runtime.Remoting.Messaging.IMethodCallMessage
 reqMcmMsg, bool useDispatchMessage, int callType) + 0x28d bytes  
        
mscorlib.dll!System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(System.Runtime.Remoting.Messaging.IMessage
 reqMsg) + 0x113 bytes      
        
mscorlib.dll!System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData
 msgData, int type) + 0x288 bytes       
        mscorlib.dll!System.AppDomain.Unload(System.AppDomain domain) + 0x32 
bytes      
        
system.web.dll!System.Web.HttpRuntime.ReleaseResourcesAndUnloadAppDomain(System.Object
 state = <undefined value>) + 0x67 bytes  

------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to