mirror of
https://github.com/frappe/bench.git
synced 2024-11-12 00:06:36 +00:00
fix: Use NullHandler for commands executed outside a bench dir
This commit is contained in:
parent
28302f67a3
commit
31f2999b4b
@ -444,12 +444,12 @@ def setup_logging(bench_path='.'):
|
|||||||
|
|
||||||
if os.path.exists(os.path.join(bench_path, 'logs')):
|
if os.path.exists(os.path.join(bench_path, 'logs')):
|
||||||
log_file = os.path.join(bench_path, 'logs', 'bench.log')
|
log_file = os.path.join(bench_path, 'logs', 'bench.log')
|
||||||
|
hdlr = logging.FileHandler(log_file)
|
||||||
else:
|
else:
|
||||||
log_file = os.path.join(os.path.expanduser("~"), 'bench.log')
|
hdlr = logging.NullHandler()
|
||||||
|
|
||||||
logger = logging.getLogger(bench.PROJECT_NAME)
|
logger = logging.getLogger(bench.PROJECT_NAME)
|
||||||
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
|
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
|
||||||
hdlr = logging.FileHandler(log_file)
|
|
||||||
hdlr.setFormatter(formatter)
|
hdlr.setFormatter(formatter)
|
||||||
logger.addHandler(hdlr)
|
logger.addHandler(hdlr)
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
Loading…
Reference in New Issue
Block a user