From 1a20ba1121481a71cdbd2bf86a3d93ff1ae5e3d3 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Wed, 15 Jun 2011 12:32:22 -0700 Subject: [PATCH] Tee teuthology log into the archive directory, if archiving. --- teuthology/run.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/teuthology/run.py b/teuthology/run.py index 16a0caad95361..e3072fa5f155a 100644 --- a/teuthology/run.py +++ b/teuthology/run.py @@ -64,6 +64,17 @@ def main(): if ctx.archive is not None: os.mkdir(ctx.archive) + handler = logging.FileHandler( + filename=os.path.join(ctx.archive, 'teuthology.log'), + ) + formatter = logging.Formatter( + fmt='%(asctime)s.%(msecs)03d %(levelname)s:%(name)s:%(message)s', + datefmt='%Y-%m-%dT%H:%M:%S', + ) + handler.setFormatter(formatter) + logging.getLogger().addHandler(handler) + + with file(os.path.join(ctx.archive, 'config.yaml'), 'w') as f: yaml.safe_dump(ctx.config, f, default_flow_style=False) -- 2.39.5