logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob L. Anawalt" <janaw...@geckosoftware.com>
Subject Re: How to config log4cxx to delete the log files periodically
Date Mon, 22 Sep 2008 23:36:40 GMT
On 2008-09-19 15:31, Jacob L. Anawalt wrote:
> heartedly. This discussion and some recent tweaking of a mail service's 
> log rotation (via logrotate) on one server motivated me to figure out 
> how to make this work.
> 

I have implemented this in my multi-threaded application by blocking all signals 
I want to respond to before starting any threads, and then starting an async 
signal handler thread to loop on sigwait. When I get a SIGHUP I simply call 
log4cxx::xml::DOMConfigurator::configure(confFile). This makes my program act 
like most daemons where they re-read the config and reopen files on SIGHUP.

This seems to work well, but I am going to review the log4cxx code a little 
closer since it is starting it's own threads, possibly before I block the 
signals. I didn't notice a problem in the "single threaded"* version using 
sigaction or this multi-threaded one but that could have been chance.

* In log4cxx-hup I was momentarily forgetting that log4cxx was starting it's own 
threads. It almost seems strange that I didn't run into trouble using sigaction.

-- 
Jacob Anawalt
Gecko Software, Inc.
janawalt@geckosoftware.com
435-752-8026

Mime
View raw message