For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

How to Configure Logging for the Java Thin Client

Configure logging for the GridGain 9 Java thin client using java.util.logging, Logback, or Log4j2.

Prerequisites

  • Java 11 or later

  • A GridGain 9 thin client dependency in your Maven or Gradle project

  • A running cluster for verification (How to Start a Cluster With Docker Compose)

  • Framework-specific (pick one):

    • java.util.logging: No additional dependencies (included in the JDK)

    • Logback: slf4j-api 2.0+ and logback-classic 1.5+

    • Log4j2: log4j-api, log4j-core, and log4j-jpl 2.24+

Maven dependency
<dependency>
    <groupId>org.gridgain</groupId>
    <artifactId>ignite-client</artifactId>
    <!-- Use the latest GridGain 9 version -->
    <version>LATEST_GRIDGAIN_9_VERSION</version>
</dependency>

GridGain 9 artifacts are hosted on the GridGain Nexus repository, not Maven Central. Add this to your pom.xml:

Required repository
<repositories>
    <repository>
        <id>gridgain-external</id>
        <url>https://www.gridgainsystems.com/nexus/content/repositories/external</url>
    </repository>
</repositories>

The group ID is org.gridgain, but the artifact name keeps the ignite- prefix. All Java packages remain org.apache.ignite.*.

Overview

Configure diagnostic logging for the GridGain 9 Java thin client using java.util.logging (JUL), Logback with SLF4J, or Log4j2. The thin client uses System.Logger (Java 9+) and routes to JUL by default. Three framework sections follow: pick the one that matches your project and skip the others.

JUL uses different level names than Logback and Log4j2. The level mapping table below applies to all three configurations.

Level Name Mapping

JUL rejects level names like DEBUG or TRACE with IllegalArgumentException: Bad level "DEBUG". Use the correct names for your framework:

Severity
System.Logger
java.util.logging
Logback / Log4j2

Most verbose

TRACE

FINER

TRACE

Diagnostic

DEBUG

FINE

DEBUG

Informational

INFO

INFO

INFO

Potential issues

WARNING

WARNING

WARN

Failures

ERROR

SEVERE

ERROR

Configure java.util.logging

JUL is the default backend with no additional dependencies.

Properties File Approach

Create a file named logging.properties:

org.apache.ignite.internal.client.level = FINE sets the client package to diagnostic output. The ConsoleHandler.level must also be FINE or the handler filters out the messages before they reach the console.

Load the properties file at JVM startup:

Programmatic Approach

Configure JUL in code if JVM startup parameters are not modifiable:

Call configureLogging() before creating the IgniteClient.

Verify JUL Output

Connect to the cluster. Connection events appear at FINE level on standard error:

Configure Logback With SLF4J

Logback requires an adapter to bridge System.Logger to SLF4J. Add the dependencies, create the adapter and factory classes, and pass the factory to the client builder.

Add Logback Dependencies

Create the System.Logger Adapter

Create the adapter that implements System.Logger and delegates to SLF4J:

isLoggable() delegates level checks to the SLF4J logger. The two log() overloads handle throwables and format parameters respectively. MessageFormat.format() applies {0}, {1} substitution before passing the message to SLF4J.

Create the LoggerFactory

Pass the Factory to the Client Builder

Configure logback.xml

additivity="false" on the GridGain logger prevents messages from propagating to the root logger. Without it, each client message appears twice.

Verify Logback Output

Connect to the cluster. Connection events appear at DEBUG level:

The abbreviated logger name o.a.i.i.client.TcpClientChannel corresponds to org.apache.ignite.internal.client.TcpClientChannel. The %logger{36} pattern shortens package segments to fit within 36 characters.

Configure Log4j2

The log4j-jpl module bridges System.Logger to Log4j2 automatically via ServiceLoader. No custom adapter or factory class is needed.

Add Log4j2 Dependencies

log4j-jpl registers a System.LoggerFinder via META-INF/services. The JVM discovers it on the first call to System.getLogger() and routes all System.Logger output to Log4j2.

Build the Client

The standard builder uses System.Logger internally, and log4j-jpl intercepts it:

Configure log4j2.xml

The status="WARN" attribute on <Configuration> controls Log4j2's own internal logging. The GridGain client logger is set to DEBUG with additivity="false" to prevent duplicate output through the root logger.

Verify Log4j2 Output

Connect to the cluster. Connection events appear at DEBUG level:

The full class name org.apache.ignite.internal.client.TcpClientChannel appears because the name fits within the %logger{36} width limit. The output format matches the PatternLayout in log4j2.xml.

Log Categories

The client creates loggers from fully qualified class names. Use these names in your logging configuration to control verbosity per component:

Category
What it logs

org.apache.ignite.internal.client.TcpClientChannel

Connection establishment, heartbeats, request/response cycles

org.apache.ignite.internal.client.ReliableChannel

Failover decisions, retry attempts, channel selection

org.apache.ignite.internal.client.sql.ClientSql

SQL query execution, partition awareness routing

org.apache.ignite.internal.client.table.ClientTable

Table operations, schema version management

org.apache.ignite.internal.streamer.StreamerSubscriber

Bulk data streaming, batch processing (this category is outside the org.apache.ignite.internal.client parent)

org.apache.ignite.internal.client.ClientTimeoutWorker

Operation timeout detection and handling

The parent category org.apache.ignite.internal.client controls the client logging categories that start with that prefix with a single entry. Data streamer logging is configured separately, through the streamer category above. Use the specific categories above to enable verbose logging for one component without increasing output from the others.

Production Recommendations

Set the client logger to WARN (WARNING in JUL) in production. Connection failures, heartbeat timeouts, and handshake errors appear at WARN level; per-request output does not.

Logback:

Log4j2:

java.util.logging:

Enable DEBUG (FINE in JUL) temporarily to troubleshoot connection or failover issues. TRACE (FINER in JUL) logs every outbound request with operation code and destination address; use it only for short diagnostic sessions.

Troubleshooting

No log output appears

The client connects and operates normally, but no log messages appear in the console or log file.

JUL: Both the logger level and the handler level must be set. A logger set to FINE with a handler still at INFO produces no FINE-level output. Set both:

Logback/Log4j2: Verify that the configuration file is on the classpath (src/main/resources/). Verify that the logger name matches exactly: org.apache.ignite.internal.client.

Logback only: Verify that the Slf4jLoggerFactory is passed to the client builder. Without it, the client uses JUL regardless of the Logback configuration.

"Bad level" exception at startup

IllegalArgumentException: Bad level "DEBUG" when loading logging.properties.

Replace the SLF4J/Log4j2 level name with the JUL equivalent. DEBUG becomes FINE, TRACE becomes FINER, ERROR becomes SEVERE, and WARN becomes WARNING.

Logs appear on console but not in file

Console output shows client log messages, but the expected log file is empty or missing.

JUL: Add the file handler to the handlers property and verify that the application has write permission to the target directory:

The %h token resolves to the user home directory. The %u token adds a unique number to prevent file conflicts when multiple JVMs run simultaneously.

Logback/Log4j2: Add a file appender to the GridGain logger in the configuration file and verify the log directory exists.

Duplicate log messages

Each client log message appears twice in the console output.

Logback: Set additivity="false" on the GridGain logger. Without this attribute, messages propagate to the root logger and appear from both the GridGain appender and the root appender.

Log4j2: The same fix applies with Log4j2's capitalized element name:

This page is: Copyright © 2026 MariaDB. All rights reserved.

Last updated

Was this helpful?