azure-functions-python-worker
azure-functions-python-worker copied to clipboard
[FeatureRequest] support for filtering logs
User functions have a single global log level. It would beneficial to enable an consistent mechanism to add filter logging prior to the logs hitting app-insights.
Our guidance is to configure filtering on the host, is able to filter logs from the app, the Python language worker, as well as the host itself.
It is a bit difficult to figure out the log categories without going to App Insights. I have some samples here: https://github.com/anthonychu/functions-log-suppression
As Anthony already mentioned, you could use host.json config to specify your log level. For Python specifically, we have a change that is pending deployment to fix DEBUG log level bug: https://github.com/Azure/azure-functions-python-worker/issues/735
Many python libraries set their level to 'info' and include debug information at that level, including Azure SDK libraries. I want to set the info
level for my app's logs, but not all of the logging from all of the libraries that I use.
If this was a standard python app, I would setup a logging.basicConfig with the default level to warning, then set my app specific logger to INFO. However, I don't have a direct handle to the azure functions worker's logging handle.
I could update the context of the azure_functions_worker.logger.handler on every execution to add this filtering, that seems fragile.
Is there way to handle this use case?