From 7be8d69b65f7daf3da1b7ec132e915201f57849b Mon Sep 17 00:00:00 2001 From: 8naama Date: Sun, 22 Dec 2024 11:55:46 +0200 Subject: [PATCH] fix java otel example --- docs/shipping/Code/java.md | 77 ++++---------------------------------- 1 file changed, 7 insertions(+), 70 deletions(-) diff --git a/docs/shipping/Code/java.md b/docs/shipping/Code/java.md index 381496ff..22b0bd07 100644 --- a/docs/shipping/Code/java.md +++ b/docs/shipping/Code/java.md @@ -513,28 +513,14 @@ If you need an example aplication to test this integration, please refer to our ### Configure the instrumentation -Add the following dependencies to `pom.xml`: - -```xml - - - - 4.0.0 +:::note +The below guide is using LogBack appender. OpenTelemetry also support [Log4J Appender](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/log4j/log4j-appender-2.17/library/README.md). +::: - com.logzio.otel - otel-log - 1.0-SNAPSHOT - otel-log - jar - - UTF-8 - 17 - 3.0.6 - +Add the following dependencies to `pom.xml`: +```xml @@ -577,18 +563,6 @@ Add the following dependencies to `pom.xml`: opentelemetry-exporter-otlp-logs - - - org.springframework.boot - spring-boot-starter - ${spring-boot.version} - - - org.springframework.boot - spring-boot-starter-web - ${spring-boot.version} - - ch.qos.logback @@ -613,43 +587,6 @@ Add the following dependencies to `pom.xml`: 1.25.1-alpha - - - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot.version} - - - - maven-assembly-plugin - 3.5.0 - - - jar-with-dependencies - - - - com.logzio.otel.DiceApplication - - - - - - make-assembly - package - - single - - - - - - - - ``` @@ -672,7 +609,7 @@ import io.opentelemetry.api.common.Attributes; public class OpenTelemetryConfig { private static final String DEFAULT_ENDPOINT = "https://otlp-listener.logz.io/v1/logs"; - private static final String LOGZ_IO_TOKEN = ""; + private static final String LOGZ_IO_TOKEN = "<>"; private static final String SERVICE_NAME = "java-otlp"; public void initializeOpenTelemetry() { @@ -711,7 +648,7 @@ public class OpenTelemetryConfig { Update the `listener.logz.io` part in `https://otlp-listener.logz.io/v1/logs` with the URL for [your hosting region](https://docs.logz.io/docs/user-guide/admin/hosting-regions/account-region). -#### Add the Logback +#### Configure Logback ```xml