mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 08:30:39 +00:00
fix: Log in ~/bench.log if not running inside bench directory
This commit is contained in:
parent
a1b4dc4a49
commit
28302f67a3
@ -27,7 +27,7 @@ def cli():
|
|||||||
command = " ".join(sys.argv)
|
command = " ".join(sys.argv)
|
||||||
|
|
||||||
change_working_directory()
|
change_working_directory()
|
||||||
logger = setup_logging() or logging.getLogger(bench.PROJECT_NAME)
|
logger = setup_logging()
|
||||||
logger.info(command)
|
logger.info(command)
|
||||||
check_uid()
|
check_uid()
|
||||||
change_dir()
|
change_dir()
|
||||||
|
@ -443,15 +443,18 @@ def setup_logging(bench_path='.'):
|
|||||||
logging.Logger.log = logv
|
logging.Logger.log = logv
|
||||||
|
|
||||||
if os.path.exists(os.path.join(bench_path, 'logs')):
|
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')
|
log_file = os.path.join(bench_path, 'logs', 'bench.log')
|
||||||
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
|
else:
|
||||||
hdlr = logging.FileHandler(log_file)
|
log_file = os.path.join(os.path.expanduser("~"), 'bench.log')
|
||||||
hdlr.setFormatter(formatter)
|
|
||||||
logger.addHandler(hdlr)
|
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
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():
|
def get_process_manager():
|
||||||
|
Loading…
Reference in New Issue
Block a user