mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Apply log level cmd line option to log file
This commit is contained in:
parent
4c0fc52e9e
commit
b3290f12d2
@ -1,6 +1,9 @@
|
|||||||
import copy
|
import copy
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from bigchaindb.log.configs import SUBSCRIBER_LOGGING_CONFIG as log_config
|
||||||
|
|
||||||
# from functools import reduce
|
# from functools import reduce
|
||||||
# PORT_NUMBER = reduce(lambda x, y: x * y, map(ord, 'BigchainDB')) % 2**16
|
# PORT_NUMBER = reduce(lambda x, y: x * y, map(ord, 'BigchainDB')) % 2**16
|
||||||
# basically, the port number is 9984
|
# basically, the port number is 9984
|
||||||
@ -73,19 +76,16 @@ config = {
|
|||||||
'keyring': [],
|
'keyring': [],
|
||||||
'backlog_reassign_delay': 120,
|
'backlog_reassign_delay': 120,
|
||||||
'log': {
|
'log': {
|
||||||
# TODO Document here or elsewhere.
|
'file': log_config['handlers']['file']['filename'],
|
||||||
# Example of config:
|
'error_file': log_config['handlers']['errors']['filename'],
|
||||||
# 'file': '/var/log/bigchaindb.log',
|
'level_console': logging.getLevelName(
|
||||||
# 'level_console': 'info',
|
log_config['handlers']['console']['level']),
|
||||||
# 'level_logfile': 'info',
|
'level_logfile': logging.getLevelName(
|
||||||
# 'datefmt_console': '%Y-%m-%d %H:%M:%S',
|
log_config['handlers']['file']['level']),
|
||||||
# 'datefmt_logfile': '%Y-%m-%d %H:%M:%S',
|
'datefmt_console': log_config['formatters']['console']['datefmt'],
|
||||||
# 'fmt_console': '%(asctime)s [%(levelname)s] (%(name)s) %(message)s',
|
'datefmt_logfile': log_config['formatters']['file']['datefmt'],
|
||||||
# 'fmt_logfile': '%(asctime)s [%(levelname)s] (%(name)s) %(message)s',
|
'fmt_console': log_config['formatters']['console']['format'],
|
||||||
# 'granular_levels': {
|
'fmt_logfile': log_config['formatters']['file']['format'],
|
||||||
# 'bichaindb.backend': 'info',
|
|
||||||
# 'bichaindb.core': 'info',
|
|
||||||
# },
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,10 @@ def configure_bigchaindb(command):
|
|||||||
def configure(args):
|
def configure(args):
|
||||||
try:
|
try:
|
||||||
config_from_cmdline = {
|
config_from_cmdline = {
|
||||||
'log': {'level_console': args.log_level},
|
'log': {
|
||||||
|
'level_console': args.log_level,
|
||||||
|
'level_logfile': args.log_level,
|
||||||
|
},
|
||||||
'server': {'loglevel': args.log_level},
|
'server': {'loglevel': args.log_level},
|
||||||
}
|
}
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -76,7 +76,8 @@ def test_configure_bigchaindb_logging(log_level):
|
|||||||
args = Namespace(config=None, log_level=log_level)
|
args = Namespace(config=None, log_level=log_level)
|
||||||
test_configure_logger(args)
|
test_configure_logger(args)
|
||||||
from bigchaindb import config
|
from bigchaindb import config
|
||||||
assert config['log'] == {'level_console': log_level}
|
assert config['log']['level_console'] == log_level
|
||||||
|
assert config['log']['level_logfile'] == log_level
|
||||||
|
|
||||||
|
|
||||||
def test_start_raises_if_command_not_implemented():
|
def test_start_raises_if_command_not_implemented():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user