Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable LocalCluster Logging in Apache Storm

I'm trying to get started with Apache storm by running the example code. I'm working with storm 0.10.1-beta1 off of a maven repository.

Unfortunately, when I run these, the console is flooded with info level logs, drowning out any System.out.print() calls that I've added. Is it possible to change the log level when running off of a LocalCluster? I've tried the solutions listed here and none of the solutions seem to be working.

From the link, Changing the Config.TOPOLOGY_DEBUG property to false doesn't remove the info level logs, and using the code from the link, I can't even use logger.setLevel((Level) Level.FATAL) as I get "The method setLevel(Level) is undefined for the type Logger" despite it clearly being listed in the log4j api.

Edit 1: I also tried the solution here and I put an xml called logback.xml into ./src with the following config:

<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>

Still no luck though. Is there any additional config required to tell storm to use the custom log settings?

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

like image 370
gears88 Avatar asked Jun 30 '15 17:06

gears88


1 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>
like image 74
Matthias J. Sax Avatar answered Sep 30 '22 12:09

Matthias J. Sax