I write in python and use logging.info() to print my logs.
When I enter log stream in azure functions I see many other logs among my logs.
It makes the debugging harder.
For example I have those durable function logs:
2024-03-17T13:16:01Z [Information] TaskActiviyDispatcher-2618c7d-0: Delaying work item fetching because the current active work-item count (1) exceeds the configured maximum active work-item count (1) 2024-03-17T13:16:02Z [Information] linuxfunction1-control-00: Skipping ownership lease aquiring for linuxfunction1-control-00 2024-03-17T13:16:02Z [Information] linuxfunction1-control-02: Skipping ownership lease aquiring for linuxfunction1-control-02
I don't know if they are important (can assume it is) but I want to hide them so I can concentrate on my logs.
I'm new to Azure but experienced with AWS, so if I am missing something feel free to mention.
I have created the Http trigger function with runtime stack python and added
Myfilterfunction to filter the unrequired logs.The function starts by calling
configure_logging()to set up the logging configuration.MyFilterclass according to specific log messages provided in the below code, logs containing the string "MY_APPLICATION_IDENTIFIER" will be allowed.Function code:
Output in local:
The above function deployed successfully into portal and it ran successfully in portal as well. check below:
Output in portal:
I have observed the required information logs in log stream. check below:
MyFilterclass as needed to specific requirements.