Fix #2414 (don’t use /tmp/dummy in the logging config)

This commit is contained in:
mathieui 2013-12-28 16:31:42 +01:00
parent 6461a77f29
commit 91392c721f

View file

@ -306,18 +306,6 @@ LOGGING_CONFIG = {
} }
}, },
'handlers': { 'handlers': {
'debug':{
'level':'DEBUG',
'class':'logging.FileHandler',
'filename': '/tmp/dummy',
'formatter': 'simple',
},
'error': {
'level': 'ERROR',
'class': 'logging.FileHandler',
'filename': '/tmp/dummy',
'formatter': 'simple',
},
}, },
'root': { 'root': {
'handlers': [], 'handlers': [],
@ -327,13 +315,22 @@ LOGGING_CONFIG = {
} }
if config.get('log_errors', 'true').lower() != 'false': if config.get('log_errors', 'true').lower() != 'false':
LOGGING_CONFIG['root']['handlers'].append('error') LOGGING_CONFIG['root']['handlers'].append('error')
LOGGING_CONFIG['handlers']['error']['filename'] = path.join( LOGGING_CONFIG['handlers']['error'] = {
LOG_DIR, 'level': 'ERROR',
'errors.log') 'class': 'logging.FileHandler',
'filename': path.join(LOG_DIR, 'errors.log'),
'formatter': 'simple',
}
if options.debug: if options.debug:
LOGGING_CONFIG['root']['handlers'].append('debug') LOGGING_CONFIG['root']['handlers'].append('debug')
LOGGING_CONFIG['handlers']['debug']['filename'] = options.debug LOGGING_CONFIG['handlers']['debug'] = {
'level':'DEBUG',
'class':'logging.FileHandler',
'filename': options.debug,
'formatter': 'simple',
}
if LOGGING_CONFIG['root']['handlers']: if LOGGING_CONFIG['root']['handlers']:
logging.config.dictConfig(LOGGING_CONFIG) logging.config.dictConfig(LOGGING_CONFIG)