Skip to content

Commit c46ea84

Browse files
Merge pull request #43928 from trask/logging-threshold-configuration
Cover Java agent logging threshold configuration
2 parents 0da9393 + 602e412 commit c46ea84

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

articles/azure-monitor/app/java-trace-logs.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,41 @@ If you're using Logback or Log4J (v1.2 or v2.0) for tracing, you can have your t
1818
1919
## Using the Application Insights Java agent
2020

21-
You can configure the Application Insights Java agent to automatically capture your logs,
22-
by enabling the feature in the `AI-Agent.xml` file:
21+
By default, the Application Insights Java agent automatically captures logging performed at `WARN` level and above.
22+
23+
You can change the threshold of logging that is captured using the `AI-Agent.xml` file:
24+
25+
```xml
26+
<?xml version="1.0" encoding="utf-8"?>
27+
<ApplicationInsightsAgent>
28+
<Instrumentation>
29+
<BuiltIn>
30+
<Logging threshold="info"/>
31+
</BuiltIn>
32+
</Instrumentation>
33+
</ApplicationInsightsAgent>
34+
```
35+
36+
You can disable the Java agent's logging capture using the `AI-Agent.xml` file:
2337

2438
```xml
2539
<?xml version="1.0" encoding="utf-8"?>
2640
<ApplicationInsightsAgent>
2741
<Instrumentation>
28-
<BuiltIn enabled="true">
29-
<Logging enabled="true" />
42+
<BuiltIn>
43+
<Logging enabled="false"/>
3044
</BuiltIn>
3145
</Instrumentation>
32-
<AgentLogger />
3346
</ApplicationInsightsAgent>
3447
```
3548

36-
Alternatively, you can follow the instructions below.
49+
## Alternatively (as opposed to using the Java agent), you can follow the instructions below
3750

38-
## Install the Java SDK
51+
### Install the Java SDK
3952

4053
Follow the instructions to install [Application Insights SDK for Java][java], if you haven't already done that.
4154

42-
## Add logging libraries to your project
55+
### Add logging libraries to your project
4356
*Choose the appropriate way for your project.*
4457

4558
#### If you're using Maven...
@@ -120,7 +133,7 @@ Follow the guidelines to manually install Application Insights Java SDK, downloa
120133
| Log4j v1.2 |[Log4J v1.2 appender Jar](https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22applicationinsights-logging-log4j1_2%22) |applicationinsights-logging-log4j1_2 |
121134

122135

123-
## Add the appender to your logging framework
136+
### Add the appender to your logging framework
124137
To start getting traces, merge the relevant snippet of code to the Log4J or Logback configuration file:
125138

126139
*Logback*

0 commit comments

Comments
 (0)