utils.log: Write error messages to stderr
authorMichael Hanselmann <hansmi@google.com>
Fri, 30 Sep 2011 09:28:59 +0000 (11:28 +0200)
committerMichael Hanselmann <hansmi@google.com>
Fri, 30 Sep 2011 10:10:24 +0000 (12:10 +0200)
When “gnt-cluster copyfile” failed it would only print “Copy of file …
to node … failed”. A detailed message is written using logging.error.
Writing error messages to stderr can be helpful in figuring out what
went wrong (the messages also go to the log file, but not everyone might
know about it).

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/utils/log.py

index 281f590..ceff250 100644 (file)
@@ -230,7 +230,7 @@ def SetupLogging(logfile, program, debug=0, stderr_logging=False,
     if debug:
       stderr_handler.setLevel(logging.NOTSET)
     else:
-      stderr_handler.setLevel(logging.CRITICAL)
+      stderr_handler.setLevel(logging.ERROR)
     root_logger.addHandler(stderr_handler)
 
   if syslog in (constants.SYSLOG_YES, constants.SYSLOG_ONLY):