diff --git a/src/aleph/vm/conf.py b/src/aleph/vm/conf.py index 9a04d313..cf39a80e 100644 --- a/src/aleph/vm/conf.py +++ b/src/aleph/vm/conf.py @@ -147,6 +147,7 @@ class Settings(BaseSettings): # System logs make boot ~2x slower PRINT_SYSTEM_LOGS = False IGNORE_TRACEBACK_FROM_DIAGNOSTICS = True + LOG_LEVEL = "WARNING" DEBUG_ASYNCIO = False # Networking does not work inside Docker/Podman diff --git a/src/aleph/vm/orchestrator/cli.py b/src/aleph/vm/orchestrator/cli.py index 21712204..7366a083 100644 --- a/src/aleph/vm/orchestrator/cli.py +++ b/src/aleph/vm/orchestrator/cli.py @@ -66,7 +66,7 @@ def parse_args(args): help="set loglevel to INFO", action="store_const", const=logging.INFO, - default=logging.WARNING, + default=settings.LOG_LEVEL, ) parser.add_argument( "-vv", @@ -298,7 +298,12 @@ def main(): ) # log_format = "[%(asctime)s] p%(process)s {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s" - setup_handlers(args, log_format) + handlers = setup_handlers(args, log_format) + logging.basicConfig( + level=args.loglevel, + format=log_format, + handlers=handlers, + ) logging.getLogger("aiosqlite").setLevel(logging.WARNING) logging.getLogger("sqlalchemy.engine").setLevel(logging.WARNING) diff --git a/src/aleph/vm/orchestrator/custom_logs.py b/src/aleph/vm/orchestrator/custom_logs.py index 23758bfa..7cb6e982 100644 --- a/src/aleph/vm/orchestrator/custom_logs.py +++ b/src/aleph/vm/orchestrator/custom_logs.py @@ -49,8 +49,4 @@ def setup_handlers(args, log_format): non_execution_handler.setFormatter( logging.Formatter("%(asctime)s | %(levelname)s %(name)s:%(lineno)s | %(message)s ") ) - logging.basicConfig( - level=args.loglevel, - format=log_format, - handlers=[non_execution_handler, execution_handler], - ) + return [non_execution_handler, execution_handler]