Skip to content

Commit 5923bce

Browse files
committed
Moving troubleshooting content to troubleshooting repo
1 parent f6716a1 commit 5923bce

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

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

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,108 @@ For autoinstrumentation to work successfully, these libraries must be removed.
4545

4646
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).
4747

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

50152
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).

0 commit comments

Comments
 (0)