Reputation: 9285
Most of us start using logging with the output of DEBUG messages. When the project runs for a while usually we reduce the output to INFO or even WARN levels.
But when an error occurs I just miss that DEBUG-Messages before the error came up. So this is what I want:
Just log from INFO or above. But when an error occurs I also want the DEBUG-messages that appeared before. Is there an appender or code snippet to achieve that?
Upvotes: 10
Views: 468
Reputation: 17018
Log4net has an appender for just this purpose: ´BufferingForwardingAppender´.
This tutorial contains everything you need: http://www.beefycode.com/post/Log4Net-Tutorial-pt-8-Lossy-Logging.aspx
Upvotes: 7