Skip to content

Commit

Permalink
Merge pull request #568 from naspeh-sf/fix-tests
Browse files Browse the repository at this point in the history
Allow empty LOG_CONFIG_FILE for tests
  • Loading branch information
naspeh committed Sep 8, 2016
2 parents ced6e2e + 0489f1f commit 04357a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions superdesk/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ def item_msg(msg, item):

def configure_logging(file_path):
"""
configure logging.
Configure logging.
:param str file_path:
"""
if not file_path:
return

try:
logging_conf = open(file_path, 'r')
logging_dict = yaml.load(logging_conf)
with open(file_path, 'r') as f:
logging_dict = yaml.load(f)

logging.config.dictConfig(logging_dict)
except:
logger.error('Cannot load logging config. File: {}'.format(file_path))
logger.warn('Cannot load logging config. File: %s', file_path)
2 changes: 1 addition & 1 deletion superdesk/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def env(variable, fallback_value=None):
DATE_FORMAT = '%Y-%m-%dT%H:%M:%S+0000'
PAGINATION_LIMIT = 200

LOG_CONFIG_FILE = env('LOG_CONFIG_FILE', 'logging_config.yml')
LOG_CONFIG_FILE = env('LOG_CONFIG_FILE')

APPLICATION_NAME = env('APP_NAME', 'Superdesk')
server_url = urlparse(env('SUPERDESK_URL', 'http://localhost:5000/api'))
Expand Down

0 comments on commit 04357a0

Please sign in to comment.