Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article helps you troubleshoot problems that affect autoinstrumentation in Application Insights.
Note
Autoinstrumentation was known as codeless attach before October 2021.
Telemetry data isn't reported after you enable autoinstrumentation
If you enabled Application Insights autoinstrumentation for your app service but don't see telemetry data reported, review the common scenarios in the following sections.
The Application Insights SDK was previously installed
Autoinstrumentation fails if .NET and .NET Core apps already have the Application Insights SDK installed.
To be able to autoinstrument your app, remove the Application Insights SDK.
An app was published by using an unsupported version of .NET or .NET Core
Verify that a supported version of .NET or .NET Core was used to build and publish applications.
To determine whether your version is supported, see the following .NET or .NET Core documentation:
- Application monitoring for Azure App Service and ASP.NET
- Application monitoring for Azure App Service and ASP.NET Core
A diagnostics library is detected
Autoinstrumentation fails if it detects the following libraries:
System.Diagnostics.DiagnosticSourceMicrosoft.AspNet.TelemetryCorrelationMicrosoft.ApplicationInsights
For autoinstrumentation to work successfully, these libraries must be removed.
You encounter SDK problems after you enable autoinstrumentation
If you encounter problems that are caused by the Application Insights SDK itself after you enable autoinstrumentation, collect self-diagnostic logs to diagnose the problems. For more information, see How to collect self-diagnostic logs for Application Insights SDKs.
Trouble deploying the Application Insights Monitoring Agent extension for VMs and virtual machine scale sets
Note
These troubleshooting tips apply to .NET applications.
If you have trouble deploying the extension, review the execution output that the extension logs to files in the following directories:
C:\WindowsAzure\Logs\Plugins\Microsoft.Azure.Diagnostics.ApplicationMonitoringWindows\<version>\
If your extension deployed successfully but you're unable to see telemetry, it could be one of the following issues covered in Agent troubleshooting:
- Conflicting dynamic link libraries (DLLs) in an app's bin directory.
- Conflict with IIS shared configuration.
Issues with Java app running on Azure Functions
Slow startup times
Your Java functions might have slow startup times if you adopted this feature before February 2023. From the function app Overview pane, go to Configuration in the navigation menu. Then, select Application settings and use the following steps to fix the issue.
Check to see if the following settings exist and remove them:
XDT_MicrosoftApplicationInsights_Java -> 1 ApplicationInsightsAgent_EXTENSION_VERSION -> ~2Enable the latest version by adding this setting:
APPLICATIONINSIGHTS_ENABLE_AGENT: true
Duplicate logs
If you're using log4j or logback for console logging, distributed tracing for Java Functions creates duplicate logs. These duplicate logs are then sent to Application Insights. To avoid this behavior, use the following workarounds.
Log4j
Add the following filter to your log4j.xml:
<Filters>
<ThresholdFilter level="ALL" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters>
Example:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
<Filters>
<ThresholdFilter level="ALL" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters>
</Console>
</Appenders>
<Loggers>
<Root level="error">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
Logback
Add the following filter to your logback.xml:
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>OFF</level>
</filter>
Example:
<configuration debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are by default assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%kvp- %msg%n</pattern>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>OFF</level>
</filter>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="STDOUT" />
</root>
</configuration>
More information
If you have additional questions about Application Insights autoinstrumentation, you can post them on our Microsoft Q&A question page.
Contact us for help
If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.
Third-party contact disclaimer
Microsoft provides third-party contact information to help you find additional information about this topic. This contact information may change without notice. Microsoft does not guarantee the accuracy of third-party contact information.