I currently have multiple log files in my application using log4net.
I have a top level log file which contains every type of message. I also have an error log file
From your configuration, it looks like your stack trace was included as part of your message
parameter.
EDIT -- I should have been clearer. My guess is that when you called log4net's logging methods, your first parameter (which is message
) contained the stack trace, but that's just a guess. It's also the only parameter in both of your appenders. If you don't have a parameter in your appender format, it shouldn't appear in both logs... unless of course your appender with the exception is the primary appender.
Try this instead and see what happens:
<!-- Loggers -->
<root>
<appender-ref ref="GeneralTextLog"/>
<level value="ALL"/>
</root>
<logger name="ErrorLogger">
<appender-ref ref="ErrorTextLog"/>
<levelMin value="WARN"/>
<levelMax value="FATAL"/>
</logger>
Configure the layout like this (GeneralTextLog Appender):
<layout type="log4net.Layout.PatternLayout">
<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.