You can easily configure the way Storm Server logs most important operations and errors. To do so, please edit the config/log4j.xml file. The configuration will proceed like this:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1} - %m%n"/>
</Console>
<RollingFile name="File" fileName="PATH_TO_LOG_DIRECTORY/log.log" filePattern="PATH_TO_LOG_DIRECTORY/log.%d{MM-dd-yyyy-HH-mm}.%i.log" ignoreExceptions="false">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss} %p %m%n</Pattern>
</PatternLayout>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10240 KB" />
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy>
<Delete basePath="PATH_TO_LOG_DIRECTORY/log" maxDepth="2">
<IfFileName glob="app.*.log" />
<IfLastModified age="20d" />
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
</Appenders>
<Loggers>
<Root level="All">
<AppenderRef ref="Console"/>
<AppenderRef ref="File"/>
</Root>
</Loggers>
</Configuration>
To limit the number of logs generated by the server, you can modify which log levels are displayed/saved.
<Loggers>
<Root level="All">
<AppenderRef ref="Console"/>
<AppenderRef ref="File"/>
</Root>
</Loggers>
Instead of “ALL” value level you can use:
OFF | No logs will be saved or displayed |
FATAL | Only logs related to server shutdown or malfunction |
ERROR | Error in code execution |
WARN | Information regarding potential problems |
INFO | Information regarding current server operations |
DEBUG | Not recommended – for Debug only |
TRACE | Not recommended – for Development only |