Skip to content

Commit 7d12ed8

Browse files
Merge pull request #9868 from kainawroth/kainawroth-functions
AB#7962: Java on Azure Functions - Moving troubleshooting content to troubleshooting repo
2 parents 8337e57 + 3cc728d commit 7d12ed8

File tree

1 file changed

+107
-3
lines changed

1 file changed

+107
-3
lines changed

support/azure/azure-monitor/app-insights/telemetry/auto-instrumentation-troubleshoot.md

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ title: Troubleshoot Application Insights Autoinstrumentation
33
description: Provides troubleshooting help for problems in autoinstrumentation in Application Insights.
44
author: JarrettRenshaw
55
ms.author: jarrettr
6-
ms.reviewer: matthofa, v-nawrothkai
76
ms.service: azure-monitor
8-
ms.custom: sap:Missing or incorrect telemetry and performance issues
7+
ms.custom: sap:Missing or Incorrect data after enabling Application Insights in Azure Portal
8+
ms.reviewer: matthofa, v-nawrothkai, v-ryanberg
99
ms.date: 10/14/2025
1010
---
1111
# Troubleshoot Application Insights autoinstrumentation
1212

1313
This article helps you troubleshoot problems that affect autoinstrumentation in Application Insights.
1414

1515
> [!NOTE]
16-
> Autoinstrumentation was known as "codeless attach" before October 2021.
16+
> Autoinstrumentation was known as *codeless attach* before October 2021.
1717
1818
## Telemetry data isn't reported after you enable autoinstrumentation
1919

@@ -48,8 +48,112 @@ For autoinstrumentation to work successfully, these libraries must be removed.
4848

4949
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](enable-self-diagnostics.md).
5050

51+
## Issues with Java app running on Azure Functions
52+
53+
### Slow startup times
54+
55+
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.
56+
57+
### [Windows](#tab/windows)
58+
59+
1. Check to see if the following settings exist and remove them:
60+
61+
```
62+
XDT_MicrosoftApplicationInsights_Java -> 1
63+
ApplicationInsightsAgent_EXTENSION_VERSION -> ~2
64+
```
65+
66+
2. Enable the latest version by adding this setting:
67+
68+
```
69+
APPLICATIONINSIGHTS_ENABLE_AGENT: true
70+
```
71+
72+
### [Linux Dedicated/Premium](#tab/linux)
73+
74+
1. Check to see if the following settings exist and remove them:
75+
76+
```
77+
ApplicationInsightsAgent_EXTENSION_VERSION -> ~3
78+
```
79+
80+
1. Enable the latest version by adding this setting:
81+
82+
```
83+
APPLICATIONINSIGHTS_ENABLE_AGENT: true
84+
```
85+
86+
---
87+
88+
### Duplicate logs
89+
90+
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.
91+
92+
#### Log4j
93+
94+
Add the following filter to your log4j.xml:
95+
96+
```xml
97+
<Filters>
98+
<ThresholdFilter level="ALL" onMatch="DENY" onMismatch="NEUTRAL"/>
99+
</Filters>
100+
```
101+
102+
Example:
103+
104+
```xml
105+
<?xml version="1.0" encoding="UTF-8"?>
106+
<Configuration status="WARN">
107+
<Appenders>
108+
<Console name="Console" target="SYSTEM_OUT">
109+
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
110+
<Filters>
111+
<ThresholdFilter level="ALL" onMatch="DENY" onMismatch="NEUTRAL"/>
112+
</Filters>
113+
</Console>
114+
</Appenders>
115+
<Loggers>
116+
<Root level="error">
117+
<AppenderRef ref="Console"/>
118+
</Root>
119+
</Loggers>
120+
</Configuration>
121+
```
122+
123+
#### Logback
124+
125+
Add the following filter to your logback.xml:
126+
127+
```xml
128+
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
129+
<level>OFF</level>
130+
</filter>
131+
```
132+
133+
Example:
134+
135+
```xml
136+
<configuration debug="true">
137+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
138+
<!-- encoders are by default assigned the type
139+
ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
140+
<encoder>
141+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%kvp- %msg%n</pattern>
142+
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
143+
<level>OFF</level>
144+
</filter>
145+
</encoder>
146+
</appender>
147+
<root level="debug">
148+
<appender-ref ref="STDOUT" />
149+
</root>
150+
</configuration>
151+
```
152+
51153
## More information
52154

53155
If you have additional questions about Application Insights autoinstrumentation, you can post them on our [Microsoft Q&A question page](/answers/topics/azure-monitor.html).
54156

55157
[!INCLUDE [Azure Help Support](../../../../includes/azure-help-support.md)]
158+
159+
[!INCLUDE [Third-party contact disclaimer](~/includes/third-party-contact-disclaimer.md)]

0 commit comments

Comments
 (0)