Compressing only old rollover files
Hello all, I'm evaluating a switch to log4j-2 since my application is required to rollover files by age and size (for what the composite triggering policies come handy). The rollover files shall also be compressed, but only those reaching a given age. What would be the preferred approach to achieve that using log4j-2? Should be reasonable to write a custom rollover strategy or is there any other way out-of-the box that may work? Thanks and best regards, Manuel.
Re: Compressing only old rollover files
Log4j currently compresses the files when it rolls them over. Of course you can cause that to happen based on time, but it sounds like you want the time of rollover and time of compression to be separate. If so, I am not sure you really need to tie the compression activity to Log4j, or at least the appender at all. You just need something that monitors the directory and looks for files over a certain age and then compresses them, deletes them, or whatever. If I’ve misunderstood what you are asking please let me know. Ralph On Apr 9, 2014, at 12:57 AM, Manuel Teira manuel.te...@gmail.com wrote: Hello all, I'm evaluating a switch to log4j-2 since my application is required to rollover files by age and size (for what the composite triggering policies come handy). The rollover files shall also be compressed, but only those reaching a given age. What would be the preferred approach to achieve that using log4j-2? Should be reasonable to write a custom rollover strategy or is there any other way out-of-the box that may work? Thanks and best regards, Manuel. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Compressing only old rollover files
It sounds like the delaycompress option from logrotate: http://linux.die.net/man/8/logrotate On 9 April 2014 09:46, Ralph Goers ralph.go...@dslextreme.com wrote: Log4j currently compresses the files when it rolls them over. Of course you can cause that to happen based on time, but it sounds like you want the time of rollover and time of compression to be separate. If so, I am not sure you really need to tie the compression activity to Log4j, or at least the appender at all. You just need something that monitors the directory and looks for files over a certain age and then compresses them, deletes them, or whatever. If I’ve misunderstood what you are asking please let me know. Ralph On Apr 9, 2014, at 12:57 AM, Manuel Teira manuel.te...@gmail.com wrote: Hello all, I'm evaluating a switch to log4j-2 since my application is required to rollover files by age and size (for what the composite triggering policies come handy). The rollover files shall also be compressed, but only those reaching a given age. What would be the preferred approach to achieve that using log4j-2? Should be reasonable to write a custom rollover strategy or is there any other way out-of-the box that may work? Thanks and best regards, Manuel. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org -- Matt Sicker boa...@gmail.com
Re: Compressing only old rollover files
Be aware you can't combine the RandomAccessFile appenders with logrotate. See https://issues.apache.org/jira/browse/LOG4J2-354 Sent from my iPhone On 2014/04/10, at 7:58, Matt Sicker boa...@gmail.com wrote: It sounds like the delaycompress option from logrotate: http://linux.die.net/man/8/logrotate On 9 April 2014 09:46, Ralph Goers ralph.go...@dslextreme.com wrote: Log4j currently compresses the files when it rolls them over. Of course you can cause that to happen based on time, but it sounds like you want the time of rollover and time of compression to be separate. If so, I am not sure you really need to tie the compression activity to Log4j, or at least the appender at all. You just need something that monitors the directory and looks for files over a certain age and then compresses them, deletes them, or whatever. If I’ve misunderstood what you are asking please let me know. Ralph On Apr 9, 2014, at 12:57 AM, Manuel Teira manuel.te...@gmail.com wrote: Hello all, I'm evaluating a switch to log4j-2 since my application is required to rollover files by age and size (for what the composite triggering policies come handy). The rollover files shall also be compressed, but only those reaching a given age. What would be the preferred approach to achieve that using log4j-2? Should be reasonable to write a custom rollover strategy or is there any other way out-of-the box that may work? Thanks and best regards, Manuel. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org -- Matt Sicker boa...@gmail.com
Catalina.out trace : memory leak
HI I got following catalina console out continuously when I try to stop the web application. Brief on configuration *version : rc1* *Log4j2.xml* Configuration status=OFF Appenders RollingRandomAccessFile name=RollingFile-${web:contextPath} fileName=${sys:catalina.home}/logs/current/${web:contextPath}.log immediateFlush=false append=false filePattern=${sys:catalina.home}/logs/archived/%d{-MM-dd}${contextName}-%d{-MM-dd}.log.gz PatternLayout Pattern%d %p %c{1.} [%t] %m%n/Pattern /PatternLayout Policies TimeBasedTriggeringPolicy / /Policies /RollingRandomAccessFile /Appenders Loggers Root level=INFO includeLocation=false AppenderRef ref=RollingFile-${web:contextPath}/ /Root /Loggers /Configuration *Tomcat properties :* Asysnc logger [tomcat is configured with the property {Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector } Apr 08, 2014 12:32:17 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/app] appears to have started a thread named [AsyncLogger-1] but has failed to stop it. *This is very likely to create a memory leak.* Apr 08, 2014 12:32:17 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/app] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@e8d7057]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info] (value [org.apache.logging.log4j.core.async.AsyncLogger$Info@67ca6737]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. What could be missing in my configuration to run into a such console trace ? What are the fixes I should look-into ? Thanks
Re: Catalina.out trace : memory leak
This may be caused by the LoggerContext.stop() method not being called. Which version of Tomcat are you using? Special care is needed for Tomcat 7.0.40 and older. A similar issue, LOG4J2-578 seemed to be caused by a config issue where the version number in web.xml was incorrect. Can you check this? Also, are the log4j jars under the shared Catalina lib? I suspect the problem goes away if you put the log4j jars under your webapp's WEB-INF/lib folder. Remko Sent from my iPhone On 2014/04/10, at 11:24, Mahesh Dilhan mail.mahesh...@gmail.com wrote: HI I got following catalina console out continuously when I try to stop the web application. Brief on configuration *version : rc1* *Log4j2.xml* Configuration status=OFF Appenders RollingRandomAccessFile name=RollingFile-${web:contextPath} fileName=${sys:catalina.home}/logs/current/${web:contextPath}.log immediateFlush=false append=false filePattern=${sys:catalina.home}/logs/archived/%d{-MM-dd}${contextName}-%d{-MM-dd}.log.gz PatternLayout Pattern%d %p %c{1.} [%t] %m%n/Pattern /PatternLayout Policies TimeBasedTriggeringPolicy / /Policies /RollingRandomAccessFile /Appenders Loggers Root level=INFO includeLocation=false AppenderRef ref=RollingFile-${web:contextPath}/ /Root /Loggers /Configuration *Tomcat properties :* Asysnc logger [tomcat is configured with the property {Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector } Apr 08, 2014 12:32:17 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/app] appears to have started a thread named [AsyncLogger-1] but has failed to stop it. *This is very likely to create a memory leak.* Apr 08, 2014 12:32:17 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/app] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@e8d7057]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info] (value [org.apache.logging.log4j.core.async.AsyncLogger$Info@67ca6737]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. What could be missing in my configuration to run into a such console trace ? What are the fixes I should look-into ? Thanks - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org