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 2022/01/21 15:49:21 UTC

[GitHub] [airflow] SamJia edited a comment on issue #21013: logging in Operator not work

SamJia edited a comment on issue #21013:
URL: https://github.com/apache/airflow/issues/21013#issuecomment-1018624809


   > You are using logging module improperly. By `logging,info` (and similar) you are logging stuff to "root" logger:
   > 
   > https://docs.python.org/3/library/logging.html#logging.info
   > 
   > > logging.info(msg, *args, **kwargs)ΒΆ
   > > Logs a message with level INFO on the root logger. The arguments are interpreted as for debug().
   > 
   > Instead you should log message to "airflow.task" logger if you want messages to show up in task log:
   > 
   > ```
   > logger = logging.getLogger("airflow.task")
   > logger.info(...)
   > ``
   > ```
   
   
   Actually I have tried to use logger `airflow.task`, but also failed
   
   ![image](https://user-images.githubusercontent.com/12780802/150556056-90dfae46-1352-434a-a455-8668289d58c9.png)
   ![image](https://user-images.githubusercontent.com/12780802/150556096-640b9487-50c4-4691-82fd-0d18606d9ca3.png)
   
   Moreover, considering the level and handler of `root` logger are replaced with the level and handler of `airflow.task` logger, I think they should work same in task operators.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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