[logback-user] Logging to stderr and stdout

Thorbjørn Ravn Andersen thunderaxiom at hotmail.com
Fri Oct 26 15:39:02 CEST 2012


The question is who needs to read what and when.  There is a vast difference
between what a normal user needs to see, and what a developer needing to do
forensic analysis needs to know. 

 

You may want to do something like this:

 

·         Anything at level INFO or above is intended to be seen by a normal
user, and the log message should be written to reflect that.  You may want
to raise the threshold to WARN depending on your users.  The output for
normal users go to standard error (since this is messages, not program
output which can be piped further on to other programs).

·         Two log files are kept in parallel – one for anything at level
INFO or above, and one for level DEBUG or above.  The first one is used by
the initial technical worker called in for triaging the situation, and the
second one for the developer responsible for investigating.  In an emergency
situation the last one may even be generated for TRACE and above.

 

So to answer your question I would suggest you log at INFO or WARN and above
depending on what the users need to see, and do so to standard error.

 

/Thorbjørn

 

 

From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On
Behalf Of Steve Ramage
Sent: 21. oktober 2012 00:30
To: logback-user at qos.ch
Subject: [logback-user] Logging to stderr and stdout

 

I had a question about the conventions of logging. We have an application
scientific in nature, and basically it runs some process for some amount of
time, and then finishes with it's output. All output in the program is
driven by logback, and we generally hide the complexity of logback from our
users, and support very limited configuration as needed.

 

One issue is where error and warning messages should go for users.

 

One argument is that they should go to stderr.  stdout should have INFO,
DEBUG, and TRACE. There doesn't seem to be an easy way to do this in
logback.

 

Another argument is that they should go to stderr. stdout should also have
them, but also INFO, DEBUG, and TRACE. If the user is running directly then
both get spammed together.

 

A final option is they should all go to stdout, as these are all log
messages, and there is no need to split them

 

Now this isn't so much a religious argument,  we are just more wondering
what the conventions were, as we would like to follow them as much possible.

 

Thanks,

 

Steve Ramage

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20121026/12485a0b/attachment.html>


More information about the Logback-user mailing list