From d8f98201ac7faccd327d23bd92034aa2b970cdca Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 6 Nov 2013 16:02:12 -0600 Subject: [PATCH] Don't re-call logging.basicConfig() Signed-off-by: Zack Cerza --- teuthology/queue.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/teuthology/queue.py b/teuthology/queue.py index e9460748f44af..26d9e830becf6 100644 --- a/teuthology/queue.py +++ b/teuthology/queue.py @@ -102,16 +102,16 @@ def worker(ctx): loglevel = logging.INFO if ctx.verbose: loglevel = logging.DEBUG - - logging.basicConfig( - level=loglevel, - filename=os.path.join(ctx.log_dir, 'worker.{tube}.{pid}'.format( - pid=os.getpid(), - tube=ctx.tube, - )), - format='%(asctime)s.%(msecs)03d %(levelname)s:%(name)s:%(message)s', - datefmt='%Y-%m-%dT%H:%M:%S', - ) + log.setLevel(loglevel) + + log_file_path = os.path.join(ctx.log_dir, 'worker.{tube}.{pid}'.format( + pid=os.getpid(), tube=ctx.tube,)) + log_handler = logging.FileHandler(filename=log_file_path) + log_formatter = logging.Formatter( + fmt='%(asctime)s.%(msecs)03d %(levelname)s:%(name)s:%(message)s', + datefmt='%Y-%m-%dT%H:%M:%S') + log_handler.setFormatter(log_formatter) + log.addHandler(log_handler) if not os.path.isdir(ctx.archive_dir): sys.exit("{prog}: archive directory must exist: {path}".format( -- 2.39.5