Commit 358f8c79 authored by Verdan Mahmood's avatar Verdan Mahmood Committed by Tamika Tannis

Adds the option to customize the logging (#362)

parent 636a7379
import ast
import importlib
import logging
import logging.config
import os
from flask import Flask
......@@ -41,8 +42,12 @@ def create_app(config_module_class: str, template_folder: str = None) -> Flask:
app.config.from_object(config_module_class)
logging.basicConfig(format=app.config.get('LOG_FORMAT'), datefmt=app.config.get('LOG_DATE_FORMAT'))
logging.getLogger().setLevel(app.config.get('LOG_LEVEL'))
if app.config.get('LOG_CONFIG_FILE'):
logging.config.fileConfig(app.config.get('LOG_CONFIG_FILE'), disable_existing_loggers=False)
else:
logging.basicConfig(format=app.config.get('LOG_FORMAT'), datefmt=app.config.get('LOG_DATE_FORMAT'))
logging.getLogger().setLevel(app.config.get('LOG_LEVEL'))
logging.info('Created app with config name {}'.format(config_module_class))
logging.info('Using metadata service at {}'.format(app.config.get('METADATASERVICE_BASE')))
logging.info('Using search service at {}'.format(app.config.get('SEARCHSERVICE_BASE')))
......
......@@ -12,6 +12,12 @@ class Config:
+ '%(threadName)s) - %(message)s'
LOG_DATE_FORMAT = '%Y-%m-%dT%H:%M:%S%z'
LOG_LEVEL = 'INFO'
# Path to the logging configuration file to be used by `fileConfig()` method
# https://docs.python.org/3.7/library/logging.config.html#logging.config.fileConfig
# LOG_CONFIG_FILE = 'amundsen_application/logging.conf'
LOG_CONFIG_FILE = None
COLUMN_STAT_ORDER = None # type: Dict[str, int]
UNEDITABLE_SCHEMAS = set() # type: Set[str]
......
......@@ -34,7 +34,7 @@ requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'r
with open(requirements_path) as requirements_file:
requirements = requirements_file.readlines()
__version__ = '1.2.0'
__version__ = '1.2.1'
setup(
......
Markdown is supported
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