Log spamming
I recently added OpenTelemetry to my azure function. The reason was because i wanted logging with custom dimensions. But when i added this, my app started spamming random logs around every 3 seconds. These logs can be seen on the image below.
Duplicate logging
Whenever i log something, the entries show up twice. It looks like 1 of the log entries comes from the Azure Function itself and 1 entry from the log exporter in the python code.
I found that you could use the OTEL_LOGS_EXPORTER
environment variable to disable the OpenTelemetry logger which removes 1 of the duplicate entries, but this is the entry with the custom dimensions i wanted. I was looking for something to disable the native logger for the azure function, but couldn’t find anything.
My research
I do not want these logs to show up every 3 seconds since they are very annoying and not useful.
Also i would love to only see the log entry i want with the custom dimensions.
I am not that familiar with OpenTelemetry and i also have limited knowledge when it comes to Azure Functions.
I have tho looked through tons of documentation and have have not found anything useful yet.
My Code
import azure.functions as func
from azure.monitor.opentelemetry import configure_azure_monitor
import cve, ddc2, ddc3
configure_azure_monitor()
app = func.FunctionApp()
app.register_blueprint(cve.bp)
app.register_blueprint(ddc2.bp)
app.register_blueprint(ddc3.bp)
(All the 3 functions are timer triggers)