SigNoz Cloud - This page is relevant for SigNoz Cloud editions.
Self-Host - This page is relevant for self-hosted SigNoz editions.

Send logs from Java to SigNoz using OpenTelemetry

Prerequisites

Choosing a Log Collection Method

There are two primary ways to send logs from your Java application to SigNoz:

  1. Application-level Collection (OTLP):
    Your application sends logs directly to SigNoz using the OpenTelemetry Java Agent.
    Recommended for: Most users. It provides automatic trace-log correlation, rich metadata, and requires no changing of infrastructure.

  2. Infrastructure-level Collection (Stdout/Stderr):
    Your application writes logs to the console, and an agent running on the node/cluster collects them.
    Recommended for: Kubernetes environments, legacy applications you can't reconfigure, or when you want strictly separated logging concerns.

This guide focuses on Application-level Collection (OTLP).

Send logs to SigNoz

The OpenTelemetry Java Agent automatically captures logs from popular logging frameworks like Log4j 2, Logback, and java.util.logging (JUL) and sends them to SigNoz.

Step 1: Download the Java Agent

Download the latest opentelemetry-javaagent.jar:

wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar

Step 2: Run the application

Set the environment variables and run your application:

export OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.<region>.signoz.cloud:443"
export OTEL_EXPORTER_OTLP_HEADERS="signoz-ingestion-key=<your-ingestion-key>"
export OTEL_SERVICE_NAME="java-app"

java -javaagent:./opentelemetry-javaagent.jar -jar your-app.jar

Verify these values:

If using a local OTel Collector (e.g., self-hosted), use:

export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
export OTEL_SERVICE_NAME="java-app"

java -javaagent:./opentelemetry-javaagent.jar -jar your-app.jar

Log Correlation

The OpenTelemetry Java Agent automatically injects trace_id and span_id into your logs when a tracing context is active, allowing you to correlate logs with traces in SigNoz.

Info

By default, the Java Agent collects traces, metrics, and logs. To collect only logs, disable traces and metrics:

export OTEL_TRACES_EXPORTER="none"
export OTEL_METRICS_EXPORTER="none"

Validate Logs

Captured logs can be viewed in the Logs Explorer section.

Java Application Logs
Java Application Logs
Java Application Logs Detailed View
Java Application Logs Detailed View

Setup OpenTelemetry Collector (Optional)

What is the OpenTelemetry Collector?

Think of the OTel Collector as a middleman between your app and SigNoz. Instead of your application sending data directly to SigNoz, it sends everything to the Collector first, which then forwards it along.

Why use it?

  • Cleaning up data — Filter out noisy traces you don't care about, or remove sensitive info before it leaves your servers.
  • Keeping your app lightweight — Let the Collector handle batching, retries, and compression instead of your application code.
  • Adding context automatically — The Collector can tag your data with useful info like which Kubernetes pod or cloud region it came from.
  • Future flexibility — Want to send data to multiple backends later? The Collector makes that easy without changing your app.

See Switch from direct export to Collector for step-by-step instructions to convert your setup.

For more details, see Why use the OpenTelemetry Collector? and the Collector configuration guide.

Troubleshooting

Why are my logs not appearing?

  • Ensure OTEL_LOGS_EXPORTER is set to otlp (for Auto-Instrumentation).
  • Verify the OTEL_EXPORTER_OTLP_ENDPOINT is correct and reachable.
  • Check the console output for any OTel-related errors.
  • If using logback.xml, ensure the OTEL appender is added to <root>.

Next Steps

Get Help

If you need help with the steps in this topic, please reach out to us on SigNoz Community Slack.

If you are a SigNoz Cloud user, please use in product chat support located at the bottom right corner of your SigNoz instance or contact us at cloud-support@signoz.io.

Last updated: February 7, 2026

Edit on GitHub

Was this page helpful?