[JDEV] patch: jabberd-1.4 logfile rotation

Ralph Siemsen ralphs at blueairnetworks.com
Tue Oct 1 14:42:54 CDT 2002


Attached is a small patch to make jabberd-1.4 play nice with the 
logrotate facility.  Actually this is only half the story, I got lost 
trying to chase down how error.log and record.log actually get written, 
so those are not yet addressed.  Pointers welcomed!

The patch adds a new command line option to jabberd: "-L filename" 
specifies the name of a logfile, which will be used instead of stdout 
and stderr.  Furthermore, if SIGHUP is sent to jabberd, it will close 
and reopen the logfile.  You'd use this with a logrotate script eg:

/var/log/jabber/jabber.log {
     daily
     rotate 7
     compress
     postrotate
         kill -HUP `cat /var/run/jabberd.pid`
     endscript
}

To handle SIGHUP there is already existing code, which reloads the 
jabber.xml file.  However comments in that code indicate that it will 
leak memory.  So I opted to disable this code, and instead only do the 
logfile close/reopen.  I prefer to restart my server when jabber.xml 
changes anyways.  Of course I'm open to better suggestions...

The patch also removes the code that prevents the simultanous use of the 
jabberd -D and -B options.  This is not required for logging, however I 
found this combination to be useful.  Any good reasons for not allowing 
this combination?

-Ralph
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jabber-logging.patch
URL: <http://mail.jabber.org/pipermail/jdev/attachments/20021001/1e95d2ec/attachment-0002.txt>


More information about the JDev mailing list