logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Trigger RollingRandomAccessFile appender programmtically?
Date Mon, 21 Dec 2015 22:11:31 GMT
You would define it as a plugin. Look at how the CronTriggeringPolicy does it.

Ralph

> On Dec 21, 2015, at 2:22 PM, John Lussmyer <Cougar@CasaDelGato.com> wrote:
> 
> I can easily write an "OnDemandTriggeringPolicy" class that implements TriggeringPolicy.
> I just don't see how I can get the RollingRandomAccessFile to use it.
> I'd prefer to just put it in my log4j.xml as one of the <Policies>, but I don't
see how to configure log4j to allow that.
> 
> On Mon Dec 21 13:05:47 PST 2015 ralph.goers@dslextreme.com said:
>> What do you mean by ?using a custom triggering policy??
>> 
>> Ralph
>> 
>>> On Dec 21, 2015, at 1:47 PM, John Lussmyer <Cougar@CasaDelGato.com> wrote:
>>> 
>>> Looking at the TriggeringPolicy interface, writing one that will do what I need
would be trivial.
>>> 
>>> The main problem is that I can't find any info on using a custom triggering policy.
>>> 
>>> On Mon Dec 21 10:48:44 PST 2015 ralph.goers@dslextreme.com said:
>>>> Log4j 2.5 added a CronTriggeringPoilicy that triggers a rollover when the
specified time pattern matches. You could look at that and create your own triggering policy
that triggers on whatever your criteria is.  As an alternative you can locate the Appender
in the configuration, obtain its manager and kick off the rollover in your code.
>>> 
>>>>> On Dec 21, 2015, at 11:16 AM, John Lussmyer <Cougar@CasaDelGato.com>
wrote:
>>>>> 
>>>>> I have a place in my program where I would like to cause my logger to
roll to the next log file.
>>>>> Basically, a "TriggerNow" triggering policy.
>>>>> Is there any reasonably easy way to do this?
>>> --
>>> 
>>> Tigers prowl and Dragons soar in my dreams...
>>> 
>>> ---------------------------------------------------------------------
>>> 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
> 
> 
> --
> 
> Tigers prowl and Dragons soar in my dreams...
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message