Logging Configuration

Hazelcast has a flexible logging configuration and does not depend on any logging framework except JDK logging. It has built-in adapters for a number of logging frameworks and it also supports custom loggers by providing logging interfaces.

To use the built-in adapters, set the hazelcast.logging.type property to one of the predefined types below:

  • jdk: JDK logging (default)

  • log4j: Log4j

  • log4j2: Log4j2

  • slf4j: Slf4j

  • none: disable logging

You can set hazelcast.logging.type through declarative configuration, programmatic configuration or JVM system property.

If you choose to use log4j, log4j2, or slf4j, you should include the proper dependencies in the classpath.

Declarative Configuration:

  • XML

  • YAML

        <property name="hazelcast.logging.type">log4j</property>
    hazelcast.logging.type: log4j

Programmatic Configuration

Config config = new Config() ;
config.setProperty( "hazelcast.logging.type", "log4j" );

System Property

  • using the java -Dhazelcast.logging.type=slf4j JVM parameter

  • using System.setProperty( "hazelcast.logging.type", "none" ); System class

If the provided logging mechanisms are not satisfactory, you can implement your own using the custom logging feature. To use it, implement the com.hazelcast.logging.LoggerFactory and com.hazelcast.logging.ILogger interfaces and set the system property hazelcast.logging.class as your custom LoggerFactory class name.


You can also listen to logging events generated by Hazelcast runtime by registering LogListeners to LoggingService.

LogListener listener = new LogListener() {
  public void log( LogEvent logEvent ) {
    // do something
HazelcastInstance instance = Hazelcast.newHazelcastInstance();
LoggingService loggingService = instance.getLoggingService();
loggingService.addLogListener( Level.INFO, listener );

Through the LoggingService, you can get the currently used ILogger implementation and log your own messages too.

If you are not using command line for configuring logging, you should be careful about Hazelcast classes. They may be defaulted to jdk logging before newly configured logging is read. When logging mechanism is selected, it will not change.

Below are example configurations for Log4j2 and Log4j. Note that Hazelcast does not recommend any specific logging library, these examples are provided only to demonstrate how to configure the logging. You can use your custom logging as explained above.

Changing Log Levels for JDK Logging

As mentioned in the introduction of this section above, the default logging type of Hazelcast IMDG is JDK logging. The default logging level is INFO. To change the level in case you want to use the default logging, you can take the following snippet as a reference:

java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger("");
for (Handler h : rootLogger.getHandlers()) {

Dynamically Changing Log Levels

You can change log levels without the need of restarting the cluster members. This may be useful while monitoring or diagnosing the events in your cluster.

This feature is supported for the default (JDK/JUL), Log4j, and Log4j2 frameworks. The Slf4j framework is not supported since it does not provide any log level changing APIs.

You can use either of the following ways to dynamically change the level of your cluster’s logs:

  • Using JMX API: The logging service exposes its JMX MBean as LoggingServiceMBean. You can retrieve, set, and reset the level. See the JMX API and Monitoring with JMX sections.

  • Using REST API: You can use the /hazelcast/rest/log-level REST endpoint to retrieve (GET), set (POST), and reset (DELETE) the level. See the REST Endpoint Groups section.

Example Log4j2 Configuration

Specify the logging type as Log4j2 and, if desired, a separate logging configuration file as shown below.

Using JVM arguments:


Using declarative configuration (hazelcast.xml/yaml):

  • XML

  • YAML

        <property name="hazelcast.logging.type">log4j2</property>
    hazelcast.logging.type: log4j2
When using the declarative configuration approach, the default log4j2.properties file should be on your classpath, where the log4j.jar files are located.

Following is an example log4j2.properties file:


appenders = console, file

appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c\{1}:%L - %m%n

appender.file.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c\{1}:%L - %m%n

rootLogger.appenderRefs= STDOUT
rootLogger.appenderRef.stdout.ref = STDOUT

#Hazelcast specific logs.



To enable the debug logs for all Hazelcast operations uncomment the below line in the above configuration file:


If you do not need detailed logs, the default settings are enough. Using the Hazelcast specific lines in the above configuration file, you can select to see specific logs (cluster, partition, hibernate, etc.) in desired levels.

You can also use the hazelcast.logging.details.enabled property to specify whether the name, IP address and version of the cluster are included in the logs. When there are lots of log lines, it may be hard to follow. When set to false, those information will not appear.

Example Log4j Configuration

Its configuration is similar to that of Log4j2. Below is the JVM argument way of specifying the logging type and configuration file:


Following is an example log4j.properties file:


log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p [%c\{1}] - %m%n