Java
This is a method of installing into an existing application using the SDK provided by Opentelemetry.
This guide is for existing JAVA applications that have been build on Cocktail Cloud.
1. Log Appender Setting
Log Appender is an interface provided by a logging framework or library that provides the ability to collect and process log messages. OpenTelemetry interacts with Log Appender through the Log Bridge API to collect log messages and associate them with tracking data from OpenTelemetry. Therefore, log appenders can be used to collect and integrate log data from OpenTelemetry.
We introduce how to collect data using logback and log4j, which are representative loggers.
1) logback
1-1) dependency addition
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-logback-appender-1.0</artifactId>
<version>2.0.0-alpha</version>
<scope>runtime</scope>
</dependency>runtimeOnly group: 'io.opentelemetry.instrumentation', name: 'opentelemetry-logback-appender-1.0', version: '2.0.0-alpha'1-2) logback.xml setting
...
<appender name="OpenTelemetry"
class="io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender">
</appender>
...
<logger name="OTLP" additivity="false">
<appender-ref ref="OpenTelemetry"/>
<level value="INFO"/>
</logger>2) log4J
2-1) dependency addition
2-2) log4j.xml setting
3) Logger setting
2. Image creation via SDK
1) Build/Pipeline - Build details of the Java application for which you want to collect logs from the build.
2) Click “Image Build Task” to edit

3) Setting environment variables and downloading SDK of Opentelemetry-java-instrumentation

3. Container Setting
1) Logging - Copy the token of the application created in Application Management

2) In Container Details - Settings - Environment Variables tab, set environment variables as follows

log-agent Service Address : Infrastructure - Cluster - Add-ons - Click 'log-agent' and check the service name.
( http port = 4318 , grpc port = 4317)

4. Check Application Log Check
1) Logging - Application Log - Search for the application you set in the application list.

Last updated
Was this helpful?
