Do not log stack traces when out of disk
This commit silences monasca-notifications in situations where it cannot write to its log file due to ENOSPC by preventing the logging module from raising exceptions (recommended best practice for production use). The old behaviour can be restored by setting the logging/raise_exceptions setting in the configuration file to True (defaults to False). Change-Id: Idbe5bdf56fb280412c34f04de8f2e2f301a7a432 Story: 2001089 Task: 4749
This commit is contained in:
parent
46b9afd03c
commit
387096c4d9
|
@ -102,6 +102,14 @@ def main(argv=None):
|
|||
config = yaml.safe_load(open(config_file, 'r'))
|
||||
|
||||
# Setup logging
|
||||
try:
|
||||
if config['logging']['raise_exceptions'] is True:
|
||||
logging.raiseExceptions = True
|
||||
else:
|
||||
logging.raiseExceptions = False
|
||||
except KeyError:
|
||||
logging.raiseExceptions = False
|
||||
pass
|
||||
logging.config.dictConfig(config['logging'])
|
||||
|
||||
for proc in range(0, config['processors']['notification']['number']):
|
||||
|
|
|
@ -89,6 +89,9 @@ zookeeper:
|
|||
60: /notification/60_seconds
|
||||
|
||||
logging: # Used in logging.dictConfig
|
||||
# This sets logging.raiseExcetpions. It is recommended to leave this set to False.
|
||||
# See https://docs.python.org/2/howto/logging.html#exceptions-raised-during-logging
|
||||
raise_exceptions: False
|
||||
version: 1
|
||||
disable_existing_loggers: False
|
||||
formatters:
|
||||
|
|
Loading…
Reference in New Issue