ashb commented on a change in pull request #9363:
URL: https://github.com/apache/airflow/pull/9363#discussion_r445424575



##########
File path: airflow/cli/commands/task_command.py
##########
@@ -185,6 +204,14 @@ def task_run(args, dag=None):
         with redirect_stdout(StreamLogWriter(ti.log, logging.INFO)), \
                 redirect_stderr(StreamLogWriter(ti.log, logging.WARN)):
             _run_task_by_selected_method(args, dag, ti)
+
+    for handler in airflow_logger_handlers:
+        if isinstance(handler, FileTaskHandler):
+            root_logger.removeHandler(handler)
+    for handler in root_logger_handlers:
+        if isinstance(handler, RedirectStdHandler):
+            root_logger.addHandler(handler)

Review comment:
       We should add a comment saying why we're doing this _right_ before we 
call `logging.shutdown` otherwise it looks like it's not needed.
   
   (We need this as one (celery) worker process can now call this multiple 
times, so if we don't reset this then logs from next task would go to the wrong 
place, right?)




----------------------------------------------------------------
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:
[email protected]


Reply via email to