Logging data - Storm Server

You can easily configure the way Storm Server logs most important operations and errors. To do so, please edit config/log4j.xml file. The configuration will like this:

                                
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="true" xmlns:log4j='http://jakarta.apache.org/log4j/'>

	<appender name="console" class="org.apache.log4j.ConsoleAppender">
	    <layout class="org.apache.log4j.PatternLayout">
		<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1} - %m%n" />
	    </layout>
	</appender>

	<appender name="file" class="org.apache.log4j.RollingFileAppender">
	    <param name="append" value="true" />
	    <param name="maxFileSize" value="10MB" />
	    <param name="maxBackupIndex" value="10" />
	    <param name="file" value="H:/StormServer/log/log.log" />
	    <layout class="org.apache.log4j.PatternLayout">
		<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1} - %m%n" />
	    </layout>
	</appender>

	<root>
		<level value="ALL" />
		<appender-ref ref="console" />
		<appender-ref ref="file" />
	</root>

</log4j:configuration>
                            

Log levels

To limit the number of logs generated by the server, you can modify which log levels are displayed/saved.

                                
<root>
    <level value="ALL" />
    <appender-ref ref="console" />
    <appender-ref ref="file" />
</root>
                            

Instead of “ALL” value level you can use:

OFFNo logs will be saved or displayed
FATALOnly logs related to server shutdown or malfunction
ERRORError in code execution
WARNInformation regarding potential problems
INFOInformation regarding current server operations
DEBUGNot recommended – for Debug only
TRACENot recommended – for Development only
Table 1. Log level values table

If you wish to diverse file and console logging you can use the following snippet:

                                
<root>
    <level value="ALL" />
    <appender-ref ref="console" />
</root>
<root>
    <level value="ERROR" />
    <appender-ref ref="file" />
</root>
                            

In this way, the server will report all data to the console but save only errors to the log file.