diff --git a/bench/cli.py b/bench/cli.py index 95ca545d..4ed7149d 100755 --- a/bench/cli.py +++ b/bench/cli.py @@ -27,7 +27,7 @@ def cli(): command = " ".join(sys.argv) change_working_directory() - logger = setup_logging() or logging.getLogger(bench.PROJECT_NAME) + logger = setup_logging() logger.info(command) if sys.argv[1] not in ("src", ): diff --git a/bench/utils.py b/bench/utils.py index 4a4fa813..8e76903f 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -443,15 +443,18 @@ def setup_logging(bench_path='.'): logging.Logger.log = logv if os.path.exists(os.path.join(bench_path, 'logs')): - logger = logging.getLogger(bench.PROJECT_NAME) log_file = os.path.join(bench_path, 'logs', 'bench.log') - formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') hdlr = logging.FileHandler(log_file) - hdlr.setFormatter(formatter) - logger.addHandler(hdlr) - logger.setLevel(logging.DEBUG) + else: + hdlr = logging.NullHandler() - return logger + logger = logging.getLogger(bench.PROJECT_NAME) + formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') + hdlr.setFormatter(formatter) + logger.addHandler(hdlr) + logger.setLevel(logging.DEBUG) + + return logger def get_process_manager():