Haapalaj commented on issue #59634:
URL: https://github.com/apache/airflow/issues/59634#issuecomment-3680580371
Here is an example code to see where the logging fails on an Airflow task
level implementation:
An custom operator having the task level logging. Both init and execute
phase logging has been working with the version 2.x Airflow, but not with 3.x
```
# An custom operator with logging
import logging
from airflow.sdk import BaseOperator
from airflow.exceptions import AirflowSkipException
log = logging.getLogger(__name__)
class MyOperator(BaseOperator):
def __init__(self, myparams,
*args, **kwargs):
self.myparams = myparams
super(MyOperator, self).__init__(*args, **kwargs)
log.info("Init myoperator")
def execute(self, context):
log.info("Execute myoperator")
```
How the custom operator is used.
```
# Then creating DAG with task like:
dag = DAG(dag_id="the_my_dag")
task = MyOperator(task_id="MyTask", dag=dag)
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]