Return-Path: X-Original-To: apmail-logging-log4j-user-archive@www.apache.org Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D38424994 for ; Thu, 7 Jul 2011 07:16:22 +0000 (UTC) Received: (qmail 26231 invoked by uid 500); 7 Jul 2011 07:16:21 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 25912 invoked by uid 500); 7 Jul 2011 07:16:11 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 25888 invoked by uid 99); 7 Jul 2011 07:16:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2011 07:16:08 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [80.12.242.127] (HELO smtp.smtpout.orange.fr) (80.12.242.127) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2011 07:16:01 +0000 Received: from mail.jalios.net ([217.128.134.72]) by mwinf5d40 with ME id 4vFg1h00G1ZtCsh03vFhih; Thu, 07 Jul 2011 09:15:41 +0200 Received: from [192.168.0.71] (unknown [192.168.0.71]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.jalios.net (Postfix) with ESMTPS id 8BBAE9FDB4; Thu, 7 Jul 2011 09:15:39 +0200 (CEST) Message-ID: <4E155D1E.4090802@jalios.com> Date: Thu, 07 Jul 2011 09:15:42 +0200 From: Olivier Jaquemet User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Log4J Users List CC: Tushar Kapila Subject: Re: Time and Size based rolling (using log4j companions extras) References: <4E132DA6.7090001@jalios.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Hello Tushar, Have it been that simple I had done it before ... Changing the time pattern would indeed solve the size trigger, as the filename would be different from the minute before, but would also change the schedule I want regarding timed rolling. Check Simon Park's site, you'll see a great comparison table indicating this limit (Roll by time AND by size), and best of all an appender implementation answering this need. http://www.simonsite.org.uk/comparison.htm Olivier On 06/07/2011 23:43, Tushar Kapila wrote: > Add hour and minute to file name pattern > > On 7/5/11, Olivier Jaquemet wrote: >> Hi, >> >> I am trying to get log4j to roll log file on a timely basis (weekly), >> while also splitting log files which grow too big. >> Exactly the same thing provided in logback through SizeAndTimeBasedFNATP : >> http://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedFNATP >> >> In order to do that I tried 2 different approach, both fails for >> different reasons. >> >> 1. Using a TimeBasedRollingPolicy, with an added SizeBasedTriggeringPolicy >> Problem: The SizeBasedTriggeringPolicy does indeed request a rollover, >> but because the filename does not change for the TimeBasedRollingPolicy, >> nothing happens (even though the rollover() method is called). >> >> > class="org.apache.log4j.rolling.RollingFileAppender"> >> >> >> >> > class="org.apache.log4j.rolling.SizeBasedTriggeringPolicy"> >> >> >> >> >> This simple approach fails because I am not using the >> TimeBasedRollingPolicy as it was conceived. I can understand that, so >> let just forget about this one and just move on to the second approach... >> >> 2. Using a FixedWindowRollingPolicy, and using a composite triggering >> policy with both a TimeBasedRollingPolicy and a SizeBasedTriggeringPolicy. >> >> Problem : The TimeBasedRollingPolicy does not work when used as a >> TriggeringPolicy. The implementation of isTriggeringEvent(..) depends on >> a 'nextCheck' variable which is only updated through rollover() method >> (not invoked because it is not being used as the the rolling policy). >> -> If TimeBasedRollingPolicy implements the TriggeringPolicy, I think it >> should support being used only this way. >> Also, as a side note, it would have been nice if the >> CompositeTriggeringPolicy java was providing an XML example of the >> declaration, I add to find the commit of this class to know how to use >> it (and indicate that warnings during the XML parsing is normal, or >> better find a way to remove those warnings). >> >> > class="org.apache.log4j.rolling.RollingFileAppender"> >> >> >> >> >> >> > class="org.apache.log4j.rolling.CompositeTriggeringPolicy"> >> >> >> >> > class="org.apache.log4j.rolling.SizeBasedTriggeringPolicy"> >> >> >> >> >> >> Is there any log4j commiter that could check my analysis and potentially >> provide a fix/workaround ? >> Otherwise, is there any other way to do time+size rolling ? >> >> Any help is really appreciated. >> Olivier >> >> -- >> @OlivierJaquemet >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org >> For additional commands, e-mail: log4j-user-help@logging.apache.org >> >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > For additional commands, e-mail: log4j-user-help@logging.apache.org > > -- Olivier Jaquemet Ing�nieur R&D Jalios S.A. - http://www.jalios.com/ @OlivierJaquemet +33970461480 --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org