Always log debug output to syslog
Add a syslog handler and make it always output debug level log messages. This way, if everything zooms by on the console, at least you've got a chance of reconstructing things from the logs/journal. Add a streamhandler to retain the interactive output, enabled for debug level with --debug as before. Change-Id: Ie50acb97bbe5a2bb3c5aa11c2c327290218abd8e
This commit is contained in:
parent
7a0f9fbddb
commit
5733aadb2c
15
glean/cmd.py
15
glean/cmd.py
@ -18,6 +18,7 @@
|
||||
import argparse
|
||||
import json
|
||||
import logging
|
||||
import logging.handlers
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
@ -500,10 +501,18 @@ def main():
|
||||
help="Enable debugging output")
|
||||
args = parser.parse_args()
|
||||
|
||||
# always log debug level logs into syslog; --debug sends detailed
|
||||
# logs to stdout
|
||||
log.setLevel(logging.DEBUG)
|
||||
syslog_handler = logging.handlers.SysLogHandler('/dev/log')
|
||||
syslog_handler.setLevel(logging.DEBUG)
|
||||
stream_handler = logging.StreamHandler()
|
||||
stream_handler.setLevel(logging.INFO)
|
||||
stream_handler.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
|
||||
log.addHandler(syslog_handler)
|
||||
log.addHandler(stream_handler)
|
||||
if args.debug:
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
else:
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
stream_handler.setLevel(logging.DEBUG)
|
||||
|
||||
log.debug("Starting glean")
|
||||
log.debug("Detected distro : %s" % args.distro)
|
||||
|
Loading…
x
Reference in New Issue
Block a user