By default, Azure’s Application Insights only captures events at the INFO level and above. I want to change the default level to INFO in a Spring Boot app. I tried to achieve this by adding the following configuration section in application.yml
azure:
application-insights:
enabled: true
connection-string: 'my-secret-connection-string'
logger:
level: DEBUG
logging:
level:
root: INFO
com.myapp: DEBUG
com.microsoft.azure.telemetry: DEBUG
But it doesn’t seem to have worked. How can I change the default logging level for Application Insights?
I’m using Spring Boot v3.2.2 with applicationinsights-web v3.4.19
2
Answers
I eventually figured out that the Spring configuration has no impact on the Application Insights log level. The correct place to configure this is in an
applicationinsights.json
file that looks like thisThe configuration you provided seems correct, but it might not be taking effect.
application.yml
file:Replace
INFO
with the desired logging level (e.g.,INFO
,DEBUG
,WARN
,ERROR
).& also check whether you’re specifying the correct logger name for Application Insights. The logger name for Application Insights might vary based on the Azure SDK version or logging framework being used.
Dependencies used in
pom.xml
:App insights: