From d688e695e6f54e37bb5ea07266c4849d3575eb7e Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Fri, 24 Feb 2017 13:31:49 +0100 Subject: [PATCH] Configure logging in `bigchaindb_configure` decorator --- bigchaindb/commands/bigchain.py | 1 - bigchaindb/commands/utils.py | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bigchaindb/commands/bigchain.py b/bigchaindb/commands/bigchain.py index 62f3a7f6..080a8cb2 100644 --- a/bigchaindb/commands/bigchain.py +++ b/bigchaindb/commands/bigchain.py @@ -25,7 +25,6 @@ from bigchaindb.commands.messages import ( RETHINKDB_STARTUP_ERROR, ) from bigchaindb.commands.utils import configure_bigchaindb, input_on_stderr -from bigchaindb.log.setup import setup_logging logging.basicConfig(level=logging.INFO) diff --git a/bigchaindb/commands/utils.py b/bigchaindb/commands/utils.py index adf0d19c..aaa92804 100644 --- a/bigchaindb/commands/utils.py +++ b/bigchaindb/commands/utils.py @@ -16,6 +16,7 @@ import bigchaindb import bigchaindb.config_utils from bigchaindb import backend from bigchaindb.common.exceptions import StartupError +from bigchaindb.log.setup import setup_logging from bigchaindb.version import __version__ @@ -23,6 +24,12 @@ def configure_bigchaindb(command): @functools.wraps(command) def configure(args): bigchaindb.config_utils.autoconfigure(filename=args.config, force=True) + + logging_config = bigchaindb.config['logging'] or {} + if 'log_level' in args and args.log_level: + logging_config['level'] = args.log_level + setup_logging(logging_config) + command(args) return configure