Hazelcast: Programmatic Configuration for Logging in Debug Mode
Attempting to configure slf4j
to enter DEBUG mode, but get only INFO logs. What am I doing wrong?
Config hazelcastConfig = new Config("HazelcastConfig");
hazelcastConfig.getProperties().put("hazelcast.logging.type", "sl4j");
hazelcastConfig.getProperties().put("slf4j.logger.com.hazelcast", "debug");
Hazelcast.newHazelcastInstance(hazelcastConfig);
+3
source to share
1 answer
You must try
Config hazelcastConfig = new Config();
hazelcastConfig.setProperty("hazelcast.logging.type", "slf4j");
Hazelcast.newHazelcastInstance(hazelcastConfig);
Keep in mind that slf4j is just a facade API for the registrar. You should use it with actual loggers like log4j or logback. All necessary banks must be in the well. Here is a tutorial on slf4j and logback
Here is an example logback.xml
.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
</encoder>
</appender>
<logger name="com.hazelcast" level="DEBUG" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
thank
+5
source to share