This is how we do it - by adding the exception as a 2nd argument to the
log4net .Error, .Info, .Debug, etc. method:
Here is an example:
.
} catch ( Exception e ) {
M_Log.Error( "Problems.", e );
.
The exception message logged along with the stack dumps.
(we only need the %m in the conversion pattern - we do not have the
%exception like you do below)
From: David Thielen <[email protected]>
Sent: Friday, January 17, 2020 7:33 PM
To: [email protected]
Subject: How do I display full exception information including inner
exception(s)
Our log4net (config below) gives us the Exception.Message, but that's all. I
need it to log the stack trace and all inner exceptions, with the stack
trace for each of those.
How do I do this?
<log4net>
<appender name="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
<param name="File" value="C:/temp/AutoTag_Word.log"/>
<param name="AppendToFile" value="true"/>
<param name="MaxSizeRollBackups" value="10"/>
<param name="MaximumFileSize" value="1000KB"/>
<param name="RollingStyle" value="Size"/>
<param name="StaticLogFileName" value="true"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] ac.server %-5p %c
- %m%n%exception"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="RollingFileAppender"/>
</root>
<logger name="WindwardArrow.net.windward.arrow.datasource.ado">
<level value="DEBUG"/>
</logger>
</log4net>
Thanks - dave