2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-24 04:59:01 +00:00

fix: Use NullHandler for commands executed outside a bench dir

This commit is contained in:
Gavin D'souza 2020-09-10 10:10:55 +05:30
parent 28302f67a3
commit 31f2999b4b

View File

@ -444,12 +444,12 @@ def setup_logging(bench_path='.'):
if os.path.exists(os.path.join(bench_path, 'logs')):
log_file = os.path.join(bench_path, 'logs', 'bench.log')
hdlr = logging.FileHandler(log_file)
else:
log_file = os.path.join(os.path.expanduser("~"), 'bench.log')
hdlr = logging.NullHandler()
logger = logging.getLogger(bench.PROJECT_NAME)
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr = logging.FileHandler(log_file)
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.DEBUG)