-
Notifications
You must be signed in to change notification settings - Fork 17.6k
[AIRFLOW-1385] Create abstraction for Airflow task logging #2422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,6 +122,12 @@ security = | |
| # values at runtime) | ||
| unit_test_mode = False | ||
|
|
||
| # Logging configuration path | ||
| logging_config_path = airflow.logging.airflow_logging_config.AIRFLOW_LOGGING_CONFIG | ||
|
|
||
| # Name of handler to read task instance logs | ||
| task_log_reader = airflow.task | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this isn't the handler, but rather the name of the handler, i.e.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I might have misunderstood that. |
||
|
|
||
| [cli] | ||
| # In what way should the cli access the API. The LocalClient will use the | ||
| # database directly, while the json_client will use the api running on the | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from airflow import configuration as conf | ||
|
|
||
| # TODO: Logging format and level should be configured | ||
| # in this file instead of from airflow.cfg. Currently | ||
| # there are other log format and level configurations in | ||
| # settings.py and cli.py. | ||
|
|
||
| LOG_LEVEL = conf.get('core', 'LOGGING_LEVEL').upper() | ||
| LOG_FORMAT = conf.get('core', 'log_format') | ||
|
|
||
|
|
||
| BASE_LOG_FOLDER = conf.get('core', 'BASE_LOG_FOLDER') | ||
| # TODO: This should be specified as s3_remote and/or gcs_remote | ||
| REMOTE_BASE_LOG_FOLDER = conf.get('core', 'REMOTE_BASE_LOG_FOLDER') | ||
|
|
||
| DEFAULT_LOGGING_CONFIG = { | ||
| 'version': 1, | ||
| 'disable_existing_loggers': False, | ||
| 'formatters': { | ||
| 'airflow.task': { | ||
| 'format': LOG_FORMAT, | ||
| } | ||
| }, | ||
| 'handlers': { | ||
| 'console': { | ||
| 'class': 'logging.StreamHandler', | ||
| 'formatter': 'airflow.task', | ||
| 'stream': 'ext://sys.stdout' | ||
| }, | ||
| 'file.task': { | ||
| 'class': 'airflow.utils.log.file_task_handler.FileTaskHandler', | ||
| 'formatter': 'airflow.task', | ||
| 'base_log_folder': BASE_LOG_FOLDER, | ||
| }, | ||
| 's3.task': { | ||
| 'class': 'airflow.utils.log.s3_task_handler.S3TaskHandler', | ||
| 'base_log_folder': BASE_LOG_FOLDER, | ||
| 'remote_base_log_folder': REMOTE_BASE_LOG_FOLDER, | ||
| 'formatter': 'airflow.task', | ||
| }, | ||
| }, | ||
| 'loggers': { | ||
| 'airflow.task': { | ||
| 'handlers': ['file.task'], | ||
| 'level': LOG_LEVEL, | ||
| 'propagate': False, | ||
| }, | ||
| 'airflow.task_runner': { | ||
| 'handlers': ['file.task'], | ||
| 'level': LOG_LEVEL, | ||
| 'propagate': True, | ||
| }, | ||
| 'airflow.task.raw': { | ||
| 'handlers': ['console'], | ||
| 'level': LOG_LEVEL, | ||
| 'propagate': False, | ||
| }, | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe a better name is airflow.utils.logging
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was about to use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other projects (django) use airflow.utils.log |
||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to correct this (DEFAULT_LOGGING)