kolla-build log to stderr

Logging to the console would traditionally go to stderr so that stdout
can be parsed by other tools for structured output.

Because logging currently goes to stdout, it is difficult to parse the
outputs of the following:

  kolla-build --format json
  kolla-build --list-images
  kolla-build --list-dependencies

This change logs to stderr instead.

Change-Id: Ib3995431408f3c2a9c1949ef72954f93e2bccddc
Closes-Bug: #1694593
This commit is contained in:
Steve Baker 2017-05-31 17:12:52 +12:00
parent e67409a17c
commit 21a8681f7b
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ def make_a_logger(conf=None, image_name=None):
log = logging.getLogger(__name__)
if not log.handlers:
if conf is None or not conf.logs_dir or not image_name:
handler = logging.StreamHandler(sys.stdout)
handler = logging.StreamHandler(sys.stderr)
log.propagate = False
else:
filename = os.path.join(conf.logs_dir, "%s.log" % image_name)