[logback-user] Best practices for FATAL errors...

Ceki Gulcu ceki at qos.ch
Mon Aug 15 11:53:02 CEST 2011


Hi Leon,

I suppose you not familiar with the concept of *markers*. You could for 
example write:

   Marker fatal = MarkerFactory.getMarker("FATAL");
   Logger logger = LoggerFactory.getLogger("myLogger");

   try {
     ...
   } catch (JDBCException je) {
    logger.error(fatal, "Lost connection to DB", je);
    ...
   }

If the you are using PatternLayout, using the %marker conversion 
specifier will add marker data to appender's output.

You can go even further and add filters or triggers based on markers. 
Holler for further details.

HTH,

On 15.08.2011 11:14, Leon Rosenberg wrote:
> On Mon, Aug 15, 2011 at 4:01 AM, Chris Pratt<thechrispratt at gmail.com>  wrote:
>> An error, is an error.  The difference is what you do about it, not what
>> level it's logged at.
>
> But the difference is also how to draw attention to the error. An
> application can produce hundreds of errors and still work for most
> users or it can be completely out of order. The difference is not what
> the app is going to do about, but how do I inform the devops/support
> about it.
> In first case it might be sufficient to check the logs in the morning
> and do something about it during next day, in second case it may be
> necessary to call someone out of the bed.
>
> This difference is 'taken' now :-)
> The alternative to create a 'fake' appender, call it fatal and log
> errors to it, seems wrong, but i have no other ideas...
>
> regards
> Leon


-- 
QOS.ch, main sponsor of cal10n, logback and slf4j open source projects, 
is looking to hire talented software engineers. For further details, see 
http://logback.qos.ch/job.html


More information about the Logback-user mailing list