Skip to content

Commit 2674b81

Browse files
Merge pull request #221533 from trask/classic-sdk
Update 2.x -> Classic SDK, also added some details about structured logging
2 parents a104bdd + 02cf4d6 commit 2674b81

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

articles/azure-monitor/app/java-in-process-agent.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ Autocollected dependencies without downstream distributed trace propagation:
168168

169169
### Autocollected logs
170170

171-
* Log4j (including MDC/Thread Context properties)
172171
* Logback (including MDC properties)
172+
* Log4j (including MDC/Thread Context properties)
173173
* JBoss Logging (including MDC properties)
174174
* java.util.logging
175175

@@ -409,30 +409,26 @@ You can use `opentelemetry-api` to get the trace ID or span ID. This action can
409409

410410
Our goal in Application Insights Java 3.x is to allow you to send your custom telemetry by using standard APIs.
411411

412-
We currently support Micrometer, popular logging frameworks, and the Application Insights Java 2.x SDK. Application Insights Java 3.x automatically captures the telemetry sent through these APIs and correlates it with autocollected telemetry.
412+
We currently support Micrometer, popular logging frameworks, and the Application Insights Java Classic SDK. Application Insights Java 3.x automatically captures the telemetry sent through these APIs and correlates it with autocollected telemetry.
413413

414414
### Supported custom telemetry
415415

416416
The following table represents currently supported custom telemetry types that you can enable to supplement the Java 3.x agent. To summarize:
417417

418418
- Custom metrics are supported through micrometer.
419419
- Custom exceptions and traces are supported through logging frameworks.
420-
- Custom requests, dependencies, metrics, and exceptions are supported through `opentelemetry-api`.
421-
- All types of the custom telemetry is supported through the [Application Insights Java 2.x SDK](#send-custom-telemetry-by-using-the-2x-sdk).
422-
423-
| Custom telemetry type | Micrometer | Log4j, logback, JUL | 2.x SDK | opentelemetry-api |
424-
|-----------------------|------------|---------------------|---------|-------------------|
425-
| Custom events | | | Yes | |
426-
| Custom metrics | Yes | | Yes | Yes |
427-
| Dependencies | | | Yes | Yes |
428-
| Exceptions | | Yes | Yes | Yes |
429-
| Page views | | | Yes | |
430-
| Requests | | | Yes | Yes |
431-
| Traces | | Yes | Yes | |
432-
433-
Currently, we're not planning to release an SDK with Application Insights 3.x.
434-
435-
Application Insights Java 3.x is already listening for telemetry that's sent to the Application Insights Java 2.x SDK. This functionality is an important part of the upgrade story for existing 2.x users. And it fills an important gap in our custom telemetry support until all custom telemetry types are supported via the OpenTelemetry API.
420+
- Custom requests, dependencies, metrics, and exceptions are supported through the OpenTelemetry API.
421+
- The remaining telemetry types are supported through the [Application Insights Classic SDK](#send-custom-telemetry-by-using-the-application-insights-classic-sdk).
422+
423+
| Custom telemetry type | Micrometer | Logback, Log4j, JUL | OpenTelemetry API | AI Classic SDK |
424+
|-----------------------|------------|---------------------|-------------------|----------------|
425+
| Custom events | | | | Yes |
426+
| Custom metrics | Yes | | Yes | Yes |
427+
| Dependencies | | | Yes | Yes |
428+
| Exceptions | | Yes | Yes | Yes |
429+
| Page views | | | | Yes |
430+
| Requests | | | Yes | Yes |
431+
| Traces | | Yes | | Yes |
436432

437433
### Send custom metrics by using Micrometer
438434

@@ -469,22 +465,26 @@ Application Insights Java 3.x is already listening for telemetry that's sent to
469465

470466
### Send custom traces and exceptions by using your favorite logging framework
471467

472-
Log4j, Logback, and java.util.logging are auto-instrumented. Logging performed via these logging frameworks is autocollected as trace and exception telemetry.
468+
Logback, Log4j, and java.util.logging are auto-instrumented. Logging performed via these logging frameworks is autocollected as trace and exception telemetry.
473469

474470
By default, logging is only collected when that logging is performed at the INFO level or above.
475471
To change this level, see the [configuration options](./java-standalone-config.md#auto-collected-logging).
476472

477-
If you want to attach custom dimensions to your logs, use [Log4j 1.2 MDC](https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/MDC.html), [Log4j 2 MDC](https://logging.apache.org/log4j/2.x/manual/thread-context.html), or [Logback MDC](http://logback.qos.ch/manual/mdc.html). Application Insights Java 3.x automatically captures those MDC properties as custom dimensions on your trace and exception telemetry.
473+
Structured logging (attaching custom dimensions to your logs) can be accomplished in these ways:
474+
* [Logback MDC](http://logback.qos.ch/manual/mdc.html)
475+
* [Log4j 2 MapMessage](https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/message/MapMessage.html) (a `MapMessage` key of `"message"` will be captured as the log message)
476+
* [Log4j 2 Thread Context](https://logging.apache.org/log4j/2.x/manual/thread-context.html)
477+
* [Log4j 1.2 MDC](https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/MDC.html)
478478

479-
### Send custom telemetry by using the 2.x SDK
479+
### Send custom telemetry by using the Application Insights Classic SDK
480480

481-
1. Add `applicationinsights-core-2.6.4.jar` to your application. All 2.x versions are supported by Application Insights Java 3.x. If you have a choice, it's worth using the latest version:
481+
1. Add `applicationinsights-core` to your application:
482482

483483
```xml
484484
<dependency>
485485
<groupId>com.microsoft.azure</groupId>
486486
<artifactId>applicationinsights-core</artifactId>
487-
<version>2.6.4</version>
487+
<version>3.4.7</version>
488488
</dependency>
489489
```
490490

0 commit comments

Comments
 (0)