You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/08/06 15:44:53 UTC

[GitHub] [airflow] bellhea removed a comment on issue #10188: task_log_prefix_template configuration is not documented and doesn't work

bellhea removed a comment on issue #10188:
URL: https://github.com/apache/airflow/issues/10188#issuecomment-669908236


   Right ok, thanks for that. 
   So instead I'm trying to use a custom logging config and implement something similar, would appreciate some guidance.. I have implemented the below custom "task_instance" formatter. I thought I should be able to see the actual dag and task ids in the log by using the relevant macros, but I'm just seeing the string "{{ti.dag_id}}-{{ti.task_id}}" itself. Any ideas?
   ```
   LOGGING_CONFIG = {
       'version': 1,
       'disable_existing_loggers': False,
       'formatters': {
           'airflow': {
               'format': LOG_FORMAT
           },
           'task_instance': {
               'format': "{{ti.dag_id}}-{{ti.task_id}} " + LOG_FORMAT
           },
           'airflow_coloured': {
               'format': COLORED_LOG_FORMAT if COLORED_LOG else LOG_FORMAT,
               FORMATTER_CLASS_KEY: COLORED_FORMATTER_CLASS if COLORED_LOG else 'logging.Formatter'
           },
       },
       'handlers': {
           'console': {
               'class': 'logging.StreamHandler',
               'formatter': 'airflow',
               'stream': 'ext://sys.stdout'
           },
           'task': {
               'class': 'airflow.utils.log.file_task_handler.FileTaskHandler',
               'formatter': 'task_instance',
               'base_log_folder': os.path.expanduser(BASE_LOG_FOLDER),
               'filename_template': FILENAME_TEMPLATE,
           },
   ...
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org