You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by cr...@apache.org on 2017/06/23 19:15:40 UTC
incubator-airflow git commit: [AIRFLOW-1337] Allow log format
customization via airflow.cfg
Repository: incubator-airflow
Updated Branches:
refs/heads/master ebed5326b -> 4841e3ead
[AIRFLOW-1337] Allow log format customization via airflow.cfg
Closes #2392 from ronfung/customize-logging-thru-config
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/4841e3ea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/4841e3ea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/4841e3ea
Branch: refs/heads/master
Commit: 4841e3eadb0acfb443d2a0ab5ad386a2c4ce70d1
Parents: ebed532
Author: Ron Fung <ro...@wepay.com>
Authored: Fri Jun 23 12:14:45 2017 -0700
Committer: Chris Riccomini <cr...@apache.org>
Committed: Fri Jun 23 12:15:30 2017 -0700
----------------------------------------------------------------------
airflow/config_templates/default_airflow.cfg | 6 ++++++
airflow/configuration.py | 2 +-
airflow/settings.py | 12 ++++--------
3 files changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/4841e3ea/airflow/config_templates/default_airflow.cfg
----------------------------------------------------------------------
diff --git a/airflow/config_templates/default_airflow.cfg b/airflow/config_templates/default_airflow.cfg
index 13a4b20..fd89e32 100644
--- a/airflow/config_templates/default_airflow.cfg
+++ b/airflow/config_templates/default_airflow.cfg
@@ -49,6 +49,12 @@ s3_log_folder =
# Logging level
logging_level = INFO
+# Log format
+LOG_FORMAT = [%%(asctime)s] {{%%(filename)s:%%(lineno)d}} %%(levelname)s - %%(message)s
+LOG_FORMAT_WITH_PID = [%%(asctime)s] [%%(process)d] {{%%(filename)s:%%(lineno)d}} %%(levelname)s - %%(message)s
+LOG_FORMAT_WITH_THREAD_NAME = [%%(asctime)s] {{%%(filename)s:%%(lineno)d}} %%(threadName)s %%(levelname)s - %%(message)s
+SIMPLE_LOG_FORMAT = %%(asctime)s %%(levelname)s - %%(message)s
+
# Size of logging buffer
logging_buffer_size = 4096
# Logging level minimum to flush buffer before full
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/4841e3ea/airflow/configuration.py
----------------------------------------------------------------------
diff --git a/airflow/configuration.py b/airflow/configuration.py
index 1bcfed0..e325067 100644
--- a/airflow/configuration.py
+++ b/airflow/configuration.py
@@ -42,7 +42,7 @@ warnings.filterwarnings(
warnings.filterwarnings(
action='default', category=PendingDeprecationWarning, module='airflow')
-ConfigParser = configparser.ConfigParser
+ConfigParser = configparser.SafeConfigParser
def generate_fernet_key():
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/4841e3ea/airflow/settings.py
----------------------------------------------------------------------
diff --git a/airflow/settings.py b/airflow/settings.py
index 47e0e54..e7566bf 100644
--- a/airflow/settings.py
+++ b/airflow/settings.py
@@ -73,14 +73,10 @@ LOGGING_LEVEL = logging.INFO
# the prefix to append to gunicorn worker processes after init
GUNICORN_WORKER_READY_PREFIX = "[ready] "
-# can't move this to conf due to ConfigParser interpolation
-LOG_FORMAT = (
- '[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s')
-LOG_FORMAT_WITH_PID = (
- '[%(asctime)s] [%(process)d] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s')
-LOG_FORMAT_WITH_THREAD_NAME = (
- '[%(asctime)s] {%(filename)s:%(lineno)d} %(threadName)s %(levelname)s - %(message)s')
-SIMPLE_LOG_FORMAT = '%(asctime)s %(levelname)s - %(message)s'
+LOG_FORMAT = conf.get('core', 'LOG_FORMAT')
+LOG_FORMAT_WITH_PID = conf.get('core', 'LOG_FORMAT_WITH_PID')
+LOG_FORMAT_WITH_THREAD_NAME = conf.get('core', 'LOG_FORMAT_WITH_THREAD_NAME')
+SIMPLE_LOG_FORMAT = conf.get('core', 'SIMPLE_LOG_FORMAT')
AIRFLOW_HOME = None
SQL_ALCHEMY_CONN = None