Is there any way to fetch the airflow logs programmatically and store it in some variable ? (in the form of strings)
I want to use the logs stored inside that variable to use all the messages present inside the ERROR logging level in airflow.
Initially, I am trying to get the logs and print them using logging.info()
I tried doing :
ti=context['ti']
logs=ti.log
logging.info(logs)````
I was expecting it to print the logs for me , but rather a logger object has been printed -
<Logger airflow.task (INFO) >
I tried converting the logger object to string using Python's str() , but it just converted <Logger airflow.task (INFO) > into strings and not the logs into strings
I tried iterating the Logger Object , but seems like that was of no help too.
Can someone please help me solve this problem ?
Thanks in advance !!