[ale] Cooperating with logrotate

Sean McNealy sean.mcnealy at gmail.com
Fri Nov 6 16:58:13 EST 2009


Well if you're the developer and already looking into changing
stuff....  Java's libraries are pretty good at stuff like this, since
everything had to be reinvented within the java world.  For example,
log4j can easily be configured to rotate logs under lots of different
conditions.

-Sean

On Fri, Nov 6, 2009 at 2:33 PM, JK <jknapka at kneuro.net> wrote:
> Brandon Checketts wrote:
>> The process that is writing to the log needs to close and reopen the file
>> handle.  Most applications support sending a HUP signal to tell the process to
>> reload its configuration, reopen log files, etc.  If this is a custom program,
>> then you would likely have to add support for that.  The exact method for doing
>> so depends on the language.
>>
>> Once you know how to get your application to reopen the log, then you would use
>> a postrotate script in the logrotate config to trigger that.  As an example, the
>> logrotate config for Apache does this:
>>
>>     postrotate
>>         /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
>>     endscript
>
>
> Thanks, that's what I'm looking at doing.  Only problem is, it's a Java
> program and there doesn't seem to be any way of installing a signal
> handler, short of resorting to native code.  But I already have some
> other channels for signaling the process, so it's doable.
>
> Muchos gracias,
>
> -- JK
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>



More information about the Ale mailing list