When using a custom "PatternLayout", log4net is appending the "exception" information (when present) to every log entry. I am trying to control the output of the message and stack trace information and would like to "suppress" this information. I have searched around but cannot find a way to do it. Any ideas?
Sample web.config entry (for a RollingFileAppender):
<layout type="Example.Class.CustomLog4netLayouts,Example">
<conversionPattern value="%date [%thread] [RID:%property{CLIENT_REQUESTID}]
%-5level %logger [%property{NDC}] - %cleanmessage - %cleanstack%newline" />
</layout>
Thanks
Configure the layout like this:
<layout type="Example.Class.CustomLog4netLayouts,Example">
<IgnoresException value="False" />
...
Setting IgnoresException
to false tells the appender that the layout will take care of the exception. Thus you can choose not to print the stack trace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With