Java SDK (BETA)

Official Java SDK for communicating with the LogFlux agent via Unix socket or TCP

Java Logo

BETA SOFTWARE: This SDK is feature-complete for basic logging use cases but is marked as BETA while we gather community feedback and add additional features. The API is stable but may evolve based on user needs.

A lightweight Java SDK for communicating with the LogFlux agent’s local server via Unix socket or TCP protocols.

Complete documentation and examples on GitHub →

Key Features

  • Multiple transport protocols: Unix socket (default), TCP
  • Async mode: Non-blocking sends with configurable buffer (default enabled)
  • Circuit breaker: Automatic failure detection and recovery
  • Batch processing: High-performance batching for throughput
  • SLF4J integration: Native Logback appender with zero code changes
  • Authentication support: TCP shared secret authentication

Built-in Logger Integrations

Integrations and adapters for popular Java logging libraries:

  • SLF4J - Standard logging facade integration
  • Logback - Native appender support
  • Standard logging - Direct SDK usage for custom applications

Installation

Maven

1
2
3
4
5
<dependency>
    <groupId>io.logflux</groupId>
    <artifactId>logflux-java-sdk</artifactId>
    <version>0.1.0-beta</version>
</dependency>

Gradle

1
implementation("io.logflux:logflux-java-sdk:0.1.0-beta")

Quick Start

Configure logback.xml:

1
2
3
4
5
6
7
8
9
<appender name="LOGFLUX" class="io.logflux.sdk.slf4j.LogFluxAppender">
    <socketPath>/tmp/logflux-agent.sock</socketPath>
    <source>my-app</source>
    <asyncMode>true</asyncMode>
</appender>

<root level="INFO">
    <appender-ref ref="LOGFLUX"/>
</root>

Use standard SLF4J logging:

1
2
3
4
5
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Logger logger = LoggerFactory.getLogger(MyApp.class);
logger.info("Hello, LogFlux!");

Direct SDK Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import io.logflux.sdk.client.LogFluxClient;
import io.logflux.sdk.types.LogEntry;
import io.logflux.sdk.types.Types;

// Create client and send log
try (LogFluxClient client = LogFluxClient.unixClient("/tmp/logflux-agent.sock")) {
    client.connect();
    
    LogEntry entry = new LogEntry("Hello, LogFlux!", "my-app")
        .withLogLevel(Types.LEVEL_INFO);
    client.sendLogEntry(entry);
}

Current Status

  • Stable API for core logging functionality
  • Production quality code and testing
  • Ready for evaluation and non-critical use cases
  • Additional features (metrics, traces, events) coming soon

Requirements

  • Java: 11 or later
  • LogFlux Agent: Required for SDK operation

Support

Disclaimer

The Java logo and trademarks are the property of Oracle Corporation. LogFlux is not affiliated with, endorsed by, or sponsored by Oracle Corporation. The Java logo is used solely for identification purposes to indicate compatibility and integration capabilities.