Page 1 of 1

Take advantage of advanced Log4J features

PostPosted: Tue Jan 11, 2011 11:32 pm
by wagstaff
Since Serviio is already using the Apache Log4J library to handle its logging, it would be nice if Serviio took advantage of some of Log4J's most powerful features like the RollingPolicy and TriggeringPolicy. When debugging issues with Serviio, we often need to set the logging level to "DEBUG" so that we can capture additional information about what Serviio is doing or attempting to do. Unfortunately, with the current configuration, once the existing log file fills up (and it fills up very quickly in DEBUG mode!), it gets erased and a new log file begins. With full implementation of the RollingPolicy and TriggeringPolicy, we could keep the earlier log files instead of watching it fall off into the "bitbucket". I realize that this may not be a highly used feature enhancement for most, but I figure it is merely a couple dozen lines of Java code to implement.

Re: Take advantage of advanced Log4J features

PostPosted: Wed Jan 12, 2011 12:13 am
by zip
There is a rolling policy in the log4j config file. It should roll into serviio.log.1, serviio.log.2, etc (max 5)

Re: Take advantage of advanced Log4J features

PostPosted: Wed Jan 12, 2011 2:30 am
by wagstaff
Hmmm. I was thinking the same thing, however, the behavior I see is that the serviio.log file grows up to the size specified by the "MaxFileSize" parameter specified in the log4j.xml and then zeroes out and begins to grow again. The file is never renamed as serviio.log.1, serviio.log.2, etc. as the new log file serviio.log is created.

I assumed that this behavior was due to the fact that you have bundled a slightly older version of the log4j.jar library with Serviio and that Serviio was not taking advantage of the newer features of Log4J. The bundled file appears to be v1.2.14, but the current stable release version from Apache is 1.2.16. The latest release also uses the log4j-extras.jar library which implements a number of additional classes such as "FixedWindowRollingPolicy.class", "TimeBasedRollingPolicy.class", and "SizeBasedTriggeringPolicy.class" among others which allow you to finely control the rollover process.

If you have been able to successfully get the bundled version of log4j and Serviio to create the multiple older copies of the serviio.log files upon rollover, then I am suspecting that I might have some sort of environmental issue. Your thoughts?

Re: Take advantage of advanced Log4J features

PostPosted: Wed Jan 12, 2011 10:31 am
by zip
wagstaff wrote:If you have been able to successfully get the bundled version of log4j and Serviio to create the multiple older copies of the serviio.log files upon rollover, then I am suspecting that I might have some sort of environmental issue. Your thoughts?


It works for me, but I saw some users complaining too: https://bitbucket.org/xnejp03/serviio/i ... r-properly

What is your OS?

Re: Take advantage of advanced Log4J features

PostPosted: Thu Jan 13, 2011 2:16 am
by wagstaff
I am currently running Serviio on a 32-bit version of MS Windows Server 2003 that is up-to-date with all service packs and security patches currently available. I am also running Java v1.6.0_21-b07.