-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verbose logs are emitted at INFO level when telemetry is sent to Application Insights #33623
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azmonapplicationinsights @jeremydvoss @lzchen. |
Could you paste/give a link to your django app? I am running your instrumented code as a standalone Python app and cannot replicate the behavior you are experiencing above: configure_azure_monitor(
logger_name="myapp",
)
logger = logging.getLogger('myapp')
logger.setLevel(logging.WARNING)
logger.warning("test log") I only see |
@lzchen Could you set root logger's log level to INFO? Here is my snippet of logging configuration.
Our app uses root logger for most of logging so INFO level is enabled. |
I am able to replicate the logs showing up printed to stdout but these logs are not captured and sent to App Insights. Please confirm whether these logs are simply showing up in console (which is expected behavior) or is it doing that AND being collected as telemetry and sent to your AppInsights instance? |
Hi @shingotoda. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
@lzchen Great to hear that you replicated the log and it is correct that the log message isn't sent to Application Insights. But the issue is that our application is running on AKS and Container Insights will capture stdout and stderr stream to send messages to Log Analytics. If we use root logger that enables INFO level logs then all these verbose logs will be sent to Log Analytics which will result in incurring log ingestion cost. I want to have this logs emitted from this library at Debug level. Does that make sense? |
This is a separate issue and unrelated to Application Insights then. If you set the root logger level to INFO, this will capture all the logs sent from your python application, including those sent by the telemetry SDK itself (those are all prefixed with the namespace |
@lzchen Thank you for the reply. I have already used a named logger for Application Insights telemetry as you suggested in #33456. Its logger name is But also, root logger is used for application log. My intent is to have separate loggers for Application Insights telemetry and application log so that telemetry will be sent to Application Insights and application log is sent to container log table in Log Analytics. Since pieces of the SDK code use root logger to emit the message in (at least my) issue at INFO level, it's displayed in stdout then sent to Log Analytics. Capturing all stdout/stderr message worked OK in our app. If the SDK is installed, the message is shown every time our app receives a HTTP request so it produces a lot of noise in application log. My question is if we could justify the INFO level log in HttpLoggingPolicy class like this to be set to DEBUG. My goal is to suppress this message. |
This is most likely by design since you are configuring the root logger and that will affect all python logging. The log messages you see are mostly related to Secondly, even if the above were to be implemented, you will still see the
|
I want to use the root logger and stop the message.
I want to also suppress this message as well. I revised it to use |
Is there any update on this? |
I face the same issue, when will it be fixed pls? |
I've set namespace is |
I have to fix temporarily by this config:
|
Describe the bug
I am writing Django app and implementing instrumentation with azure-monitor-opentelemetry. I set it up to have a named logger and set log level to WARNING. The following is the code to do this.
But I see the following message is emitted to stdout then results in being ingested to Log Analytics workspace, looks like this is a HTTP request log to send telemetry to application insights.
After I debugged with pdb, it looks that this line is processed when telemetry is sent to Application Insights.
https://github.com/Azure/azure-sdk-for-python/blob/d8bcdc57c0287dca6b6bdc192c9255616c4f36d3/sdk/core/azure-core/azure/core/pipeline/policies/_universal.py#L509C1-L512C23
This logger has root as parent.
I would personally think that since this message is too verbose from application perspective and it takes root logger, this should call
logger.debug()
instead ofinfo()
like other lines of this code like this.azure-sdk-for-python/sdk/core/azure-core/azure/core/pipeline/policies/_universal.py
Line 324 in d8bcdc5
Though it, I'm new to this codebase so my assumption might be wrong. Please let me know if there is a workaround to suppress this message.
Expected behavior
HTTP log is too verbose as it emits logs every time telemetry is sent to application insights. This should be debug log.
The text was updated successfully, but these errors were encountered: