Annette Sündermann
2004-12-08 14:24:44 UTC
I am using log4net 1.2.0 beta 8.
According to the documentation, the following code:
this.logger.Error ( "exception observed!", new Exception("I am an Exception") );
should
'Log a message object with the ERROR level including the stack trace of the Exception passed as a parameter.'
On my logfile, I only find the following text:
2004-12-08 15:21:51,171 ERROR FormPoc.Form1_Load[376]
exception observed!
Exception: System.Exception
Message: I am an Exception
No StackTrace is logged.
My log4net configuration is:
<log4net>
<!-- Define a Rolling File Appender -->
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="G:/MTraceReports/MReport/log/Poc.log"/>
<param name="AppendToFile" value="true"/>
<param name="RollingStyle" value="Size"/>
<param name="MaxSizeRollBackups" value="10"/>
<param name="MaximumFileSize" value="1MB"/>
<param name="StaticLogFileName" value="true"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p %C{1}.%M[%L]%n%m%n"/>
</layout>
</appender>
<!-- Set root logger level to DEBUG and add the RollingFileAppender -->
<root>
<level value="ALL"/>
<appender-ref ref="RollingFileAppender"/>
</root>
</log4net>
What is the reason for the missing StackTrace?
According to the documentation, the following code:
this.logger.Error ( "exception observed!", new Exception("I am an Exception") );
should
'Log a message object with the ERROR level including the stack trace of the Exception passed as a parameter.'
On my logfile, I only find the following text:
2004-12-08 15:21:51,171 ERROR FormPoc.Form1_Load[376]
exception observed!
Exception: System.Exception
Message: I am an Exception
No StackTrace is logged.
My log4net configuration is:
<log4net>
<!-- Define a Rolling File Appender -->
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="G:/MTraceReports/MReport/log/Poc.log"/>
<param name="AppendToFile" value="true"/>
<param name="RollingStyle" value="Size"/>
<param name="MaxSizeRollBackups" value="10"/>
<param name="MaximumFileSize" value="1MB"/>
<param name="StaticLogFileName" value="true"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p %C{1}.%M[%L]%n%m%n"/>
</layout>
</appender>
<!-- Set root logger level to DEBUG and add the RollingFileAppender -->
<root>
<level value="ALL"/>
<appender-ref ref="RollingFileAppender"/>
</root>
</log4net>
What is the reason for the missing StackTrace?