Disable LocalCluster registration in Apache Storm

I am trying to start by storming Apache by running the sample code . I am working with storm 0.10.1-beta1 from the maven repository.

Unfortunately, when I start them, the console is flooded with information-level logs, drowning out any System.out.print() calls that I added. Can I change the log level when starting LocalCluster? I tried the solutions listed here , and none of the solutions seem to work.

From the link Changing the Config.TOPOLOGY_DEBUG property to false does not remove the information level logs, and using the code from the link, I can’t even use logger.setLevel((Level) Level.FATAL) , because I get the " logger.setLevel((Level) Level.FATAL) Method (Level)) undefined for like Logger ", even though it is explicitly specified in the log4j api.

Edit 1 : I also tried the solution here , and I put the xml called logback.xml in. / src with the following configuration:

 <configuration monitorInterval="60"> <Appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="%-4r [%t] %-5p %c{1.} - %msg%n"/> </Console> </Appenders> <Loggers> <Logger name="org.apache.zookeeper" level="WARN"/> <Root level="WARN"> <AppenderRef ref="Console"/> </Root> </Loggers> </configuration> 

However, good luck. Is there any additional configuration needed to tell the storm about how to use custom log settings?

Update: It turns out that storm 0.10.x switched to using log4j2 instead of logback, so adding log4j2.xml with the above configuration finally worked!

+6
source share
3 answers

The following configuration works for me:

 <configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> </encoder> </appender> <root level="WARN"> <appender-ref ref="STDOUT" /> </root> </configuration> 
+1
source

To make it clear to beginners:
When working in a local cluster: whether you use slf4j or slf4j for your own application maintenance, you will end up having to use the log4j2.xml or logback.xml where you set up the configuration of how you want to log.

In this file; your own application is a log4j or logback xml file for which you need to insert a configuration that tells your application not to show logs.

So just add this somewhere between the <configuration> and </configuration> tags.

  <logger name="org.apache.storm" level="OFF"/> <logger name="org.apache.zookeeper" level="OFF"/> 
+1
source

To define the system property -Dlog4j.configurationFile=log4j2.xml is the key point in Storm 1.0.0

log4j2.xml can be a fake or non-existent file.

+1
source

Source: https://habr.com/ru/post/990033/


All Articles