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>
This works:
Use the below:
<log4net debug="false">
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="C:\temp\CleanTemplates.log" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="2" />
<param name="MaximumFileSize" value="50KB" />
<param name="RollingStyle" value="Size" />
<param name="StaticLogFileName" value="true" />
<layout type="Kailua.net.windward.utils.ExceptionFormatter">
<param name="ConversionPattern" value="%date [%thread] %level %logger - %message%newline%exception" />
</layout>
</appender>
<root>
<level value="debug" />
<appender-ref ref="RollingFileAppender" />
</root>
</log4net>