Issue Details (XML | Word | Printable)

Key: LOG4NET-36
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Nicko Cadell
Reporter: Nicko Cadell
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Log4net

System.Diagnostics.Trace may throw exception if AppDomain does not have config file

Created: 21/Jun/05 04:28 AM   Updated: 21/Jun/05 04:37 AM
Return to search
Component/s: Core
Affects Version/s: 1.2.9
Fix Version/s: 1.2.10

Time Tracking:
Not Specified

Resolution Date: 21/Jun/05 04:37 AM


 Description  « Hide
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 ---


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Nicko Cadell added a comment - 21/Jun/05 04:37 AM
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.