Prevent exception when LOG_FILE is empty

Previous version needed to set ARA_LOG_FILE to an empty string to avoid an
AttributeError. This is now incompatible with 0.15.0 and it is now failing
because the default_config is not properly formated:

  Unable to configure handler 'file': [Errno 21] Is a directory

Change-Id: I2e2c13f712ec194acc9c61cf42aa8f639becb2f4
This commit is contained in:
Tristan Cacqueray 2018-06-12 09:05:57 +00:00 committed by David Moreau Simard
parent 2cdf3b1526
commit ab2189b556
1 changed files with 2 additions and 0 deletions

View File

@ -105,6 +105,8 @@ def setup_logging(config=None):
os.makedirs(config['ARA_LOG_DIR'], mode=0o750)
if not os.path.exists(config['ARA_LOG_CONFIG']):
if not config.get('ARA_LOG_FILE'):
config['ARA_LOG_FILE'] = 'ara.log'
default_config = DEFAULT_LOG_CONFIG.format(
dir=config['ARA_LOG_DIR'],
file=config['ARA_LOG_FILE'],