mirror of
https://github.com/frappe/bench.git
synced 2024-11-12 00:06:36 +00:00
Merge pull request #1062 from gavindsouza/log-in-files
fix: Don't show logs in stdout if command run outside bench directory
This commit is contained in:
commit
f3a0bfd38a
@ -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", ):
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user