You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Nicko Cadell (JIRA)" <ji...@apache.org> on 2005/06/20 21:42:17 UTC

[jira] Resolved: (LOG4NET-36) System.Diagnostics.Trace may throw exception if AppDomain does not have config file

     [ http://issues.apache.org/jira/browse/LOG4NET-36?page=all ]
     
Nicko Cadell resolved LOG4NET-36:
---------------------------------

    Resolution: Fixed

Added try catch blocks to the LogLog internal calls. If an exception occurs in the LogLog calls the exception is caught and discarded. The LogLog class is the last line of defence and the caller does not expect it to leak exceptions, and it does not have an alternative even if it did receive the exception.

> System.Diagnostics.Trace may throw exception if AppDomain does not have config file
> -----------------------------------------------------------------------------------
>
>          Key: LOG4NET-36
>          URL: http://issues.apache.org/jira/browse/LOG4NET-36
>      Project: Log4net
>         Type: Bug
>   Components: Core
>     Versions: 1.2.9
>     Reporter: Nicko Cadell
>     Assignee: Nicko Cadell
>     Priority: Minor
>      Fix For: 1.2.10

>
> System.Diagnostics.Trace may throw exception if AppDomain does not have config file.
> If the AppDomain has been created programmatically it is possible that it does not have a config file set. It has been reported that an exception can be generated on certain platforms in this situation.
> The exception is:
> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->
> System.TypeInitializationException: The type initializer for "D2L.Mail.MailService" threw an exception. --->
> System.TypeInitializationException: The type initializer for "log4net.Core.LoggerManager" threw an exception. --->
> System.TypeInitializationException: The type initializer for "log4net.Util.LogLog" threw an exception. --->
> System.NullReferenceException: Object reference not set to an instance of an object.
>    at System.Configuration.ConfigurationSettings.GetConfig(String sectionName)
>    at System.Diagnostics.DiagnosticsConfiguration.GetConfigTable()
>    at System.Diagnostics.DiagnosticsConfiguration.Initialize()
>    at System.Diagnostics.DiagnosticsConfiguration.get_IndentSize()
>    at System.Diagnostics.TraceInternal.InitializeSettings()
>    at System.Diagnostics.TraceInternal.get_Listeners()
>    at System.Diagnostics.TraceInternal.WriteLine(String message)
>    at System.Diagnostics.Trace.WriteLine(String message)
>    at log4net.Util.LogLog.Error(String message, Exception exception)
>    at log4net.Util.LogLog..cctor()
>    --- End of inner exception stack trace ---
>    at log4net.Util.LogLog.Debug(String message)
>    at log4net.Core.LoggerManager..cctor()
>    --- End of inner exception stack trace ---
>    at log4net.Core.LoggerManager.GetLogger(Assembly
> repositoryAssembly, String name)
>    at log4net.LogManager.GetLogger(Type type)
>    at D2L.Mail.MailService..cctor()
>    --- End of inner exception stack trace ---
>    --- End of inner exception stack trace ---

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira