class_docstr: Class for sending messages to task instance logs from outside task execution context.
  
  This is intended to be used mainly in exceptional circumstances, to give visibility into
  events related to task execution when otherwise there would be none.
  
  :meta private:
class_docstr_tok: ["Class","for","sending","messages","to","task","instance","logs","from","outside","task","execution","context",".","This","is","intended","to","be","used","mainly","in","exceptional","circumstances",",","to","give","visibility","into","events","related","to","task","execution","when","otherwise","there","would","be","none",".",":","meta","private",":"]
docstr: Returns the task handler that supports task context logging.
docstr_tok: ["Returns","the","task","handler","that","supports","task","context","logging","."]
code: def _get_task_handler() -> FileTaskHandler | None:
      """Returns the task handler that supports task context logging."""
      handlers = [
          handler
          for handler in logging.getLogger("airflow.task").handlers
          if getattr(handler, "supports_task_context_logging", False)
      ]
      if not handlers:
          return None
      h = handlers[0]
      if TYPE_CHECKING:
          assert isinstance(h, FileTaskHandler)
      return h
  
file_path: airflow/airflow/utils/log/task_context_logger.py
imports: from __future__ import annotations
  import logging
  from contextlib import suppress
  from copy import copy
  from logging import Logger
  from typing import TYPE_CHECKING
  from airflow.configuration import conf
label_desc: Use image node_id 3 for calling the TaskContextLogger obj's underlying member method code with example usage: obj._get_task_handler() and returns: h, None