2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

fix: Log in ~/bench.log if not running inside bench directory

This commit is contained in:
Gavin D'souza 2020-09-03 13:13:24 +05:30
parent a1b4dc4a49
commit 28302f67a3
2 changed files with 11 additions and 8 deletions

View File

@ -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)
check_uid()
change_dir()

View File

@ -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:
log_file = os.path.join(os.path.expanduser("~"), 'bench.log')
return logger
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)
return logger
def get_process_manager():