Fixed Log Configs for SIngle-File Logging
This morning I wanted to take some time to make sure that I got all the log messages into one file, and that not being a redirection of stdout or stderr. This is something I've done a few times, and it just took the time to set up the Logback config file. The reason we're using Logback is that this is what Storm uses, and since this is a Storm jar, we needed to use this style of logging.
Interestingly, the config wasn't all that hard to get a nice, daily-rotating, compressing, log file for everything I needed:
<configuration scan="true"> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>/home/${USER}/log/experiments.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern> /home/${USER}/log/experiments_%d{yyyy-MM-dd}.log.gz </fileNamePattern> <maxHistory>30</maxHistory> </rollingPolicy> <encoder> <pattern> [%d{yyyy-MM-dd HH:mm:ss.SSS}:%thread] %-5level %logger{36} - %msg%n </pattern> </encoder> </appender> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern> [%d{yyyy-MM-dd HH:mm:ss.SSS}:%thread] %-5level %logger{36} - %msg%n </pattern> </encoder> </appender> <root level="INFO"> <appender-ref ref="FILE" /> </root> </configuration>
I have to admit that this is a decent tool - if you know how to configure it properly. But I guess that's true for a lot of the Apache projects.