[logback-user] Delaying debug logs until an error occurs

Sim Yih Tsern sim_yihtsern at yahoo.com
Sun Dec 31 13:17:46 CET 2017

That sounds like a feature you should bake into your codebase, instead of pushing it to logback.

-----Original Message-----
From: "Håvard Ottestad" <hmottestad at gmail.com>
Sent: ‎31/‎12/‎2017 18:30
To: "logback-user at qos.ch" <logback-user at qos.ch>
Subject: [logback-user] Delaying debug logs until an error occurs


Happy new year :D

I have a question that I’m having trouble formulating. 

My goal is to reduce the amount of logging in my application, but still log debug messages when there has been an error. 

I’m wondering if there is a way to have logback “save” debug messages and only log them if an error is logged at some point later on in the same transaction.

Eg. A spring web application. The user uploads a file, and at some point in the processing of the file an error occurs. Would be great now if the application would print out all debug messages associated with the file upload (including messages logged before the error), so that it would be possible to trace what happened leading up to the error. 

Having debug, info, warn and error on in production produces too many logs, which means we can’t keep them as long as we would like. So being able to trigger logging of previous debug messages on an error would give us a high level of detail in our logs when we need it the most.

logback-user mailing list
logback-user at qos.ch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20171231/39257b19/attachment.html>

More information about the logback-user mailing list