diff options
-rwxr-xr-x | dovetail/run.py | 2 | ||||
-rw-r--r-- | dovetail/utils/dovetail_logger.py | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/dovetail/run.py b/dovetail/run.py index c3c97d68..556f8137 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -211,6 +211,8 @@ def main(*args, **kwargs): dt_cfg.update_config(configs) if kwargs['report']: + if(kwargs['report'].endswith('/')): + kwargs['report'] = kwargs['report'][0:kwargs['report'].rfind('/')] dt_cfg.dovetail_config['report_dest'] = kwargs['report'] if kwargs['offline']: diff --git a/dovetail/utils/dovetail_logger.py b/dovetail/utils/dovetail_logger.py index feb7aeff..5ad127ba 100644 --- a/dovetail/utils/dovetail_logger.py +++ b/dovetail/utils/dovetail_logger.py @@ -37,22 +37,23 @@ class Logger(object): self.logger.propagate = 0 self.logger.setLevel(logging.DEBUG) + result_path = dt_cfg.dovetail_config['result_dir'] + if not os.path.exists(result_path): + os.makedirs(result_path) + ch = logging.StreamHandler(sys.stdout) formatter = logging.Formatter('%(asctime)s - %(name)s - ' '%(levelname)s - %(message)s') ch.setFormatter(formatter) + hdlr = logging.FileHandler(os.path.join(result_path, 'dovetail.log')) + hdlr.setFormatter(formatter) if DEBUG is not None and DEBUG.lower() == "true": ch.setLevel(logging.DEBUG) + hdlr.setLevel(logging.DEBUG) else: ch.setLevel(logging.INFO) + hdlr.setLevel(logging.INFO) self.logger.addHandler(ch) - - result_path = dt_cfg.dovetail_config['result_dir'] - if not os.path.exists(result_path): - os.makedirs(result_path) - hdlr = logging.FileHandler(os.path.join(result_path, 'dovetail.log')) - hdlr.setFormatter(formatter) - hdlr.setLevel(logging.DEBUG) self.logger.addHandler(hdlr) def getLogger(self): |