Commit bee67fc8 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

Making log config file location configurable

parent a9ea7ad6
"""Initialize Fractalis Flask app and configure it.
"""Initialize Fractalis Flask app and configure it."""
Modules in this package:
- config -- Manages Fractalis Flask app configuration
"""
import logging.config
import os
import yaml
from flask import Flask
......@@ -28,7 +24,7 @@ except RuntimeError:
pass
# setup logging
with open(os.path.join(os.path.dirname(__file__), 'logging.yaml'), 'rt') as f:
with open(app.config['FRACTALIS_LOG_CONFIG'], 'rt') as f:
log_config = yaml.safe_load(f.read())
logging.config.dictConfig(log_config)
log = logging.getLogger(__name__)
......
......@@ -26,10 +26,10 @@ CELERY_TASK_RESULT_EXPIRES = timedelta(hours=1)
CELERYD_HIJACK_ROOT_LOGGER = False
# Fractalis
FRACTALIS_TMP_DIR = os.path.abspath(os.path.join(
os.sep, 'tmp', 'fractalis'))
FRACTALIS_TMP_DIR = os.path.abspath(os.path.join(os.sep, 'tmp', 'fractalis'))
FRACTALIS_CACHE_EXP = timedelta(days=10)
FRACTALIS_ENCRYPT_CACHE = False
FRACTALIS_LOG_CONFIG = os.path.join(os.path.dirname(__file__), 'logging.yaml')
# DO NOT MODIFY THIS FILE DIRECTLY
......@@ -8,7 +8,7 @@ handlers:
class: logging.handlers.TimedRotatingFileHandler
level: WARNING
formatter: default
filename: /tmp/fractalis.log
filename: fractalis.log
when: midnight
backupCount: 14
encoding: utf8
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment