Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Server DIY Backup script redirect debug messages to stderr

evergine July 27, 2017

In "utils.sh" there is a function called "run", with this comment:

"Log then execute the provided command".

This is the last row of the function:

"debug "Running${cmdline}" > /dev/stderr"

 

Please explain me why a debug message should go to the stderr instead of the stdout? (it's a debug message!)

1 answer

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 8, 2017

Hi Ezio, it looks to be a general preference to have debugging messages sent to stderr instead of stdout. For example, from Stackoverflow :

 

Regular output (the actual result of running the program) should go on stdout, things like diagnostic, notice, warning, error, etc, go on stderr.

If there is no "regular output", I would say that it doesn't really matter which one you choose. You could argue that the logging is the only output, so that should go to stdout. Or you could argue that it is still "exceptional information" which should go to stderr.

The backup scripts don't really have regular output, so we 're sending those messages to stderr.
 
Hope this helps!
Ana

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events