[Zope] SIGUSR2 not working in 2.6.1?

Steve McMahon steve@reidmcmahon.com
Thu, 27 Feb 2003 09:34:27 -0800


A bit more information. This is particular to the access log (Z2.log).

When z2.py starts the access log, it successfully saves the file_logger
instance to sys.__lg:

      lg = logger.file_logger(LOG_PATH)
      zLOG.LOG('z2', zLOG.BLATHER, 'Using access log file %s' % LOG_PATH)
sys.__lg = lg

However, when Signals.py handles SIGUSR2 and tries to recover the
file_logger instance with "getattr(sys, '__lg', None)" it can't find it
and silently fails.

I can't find this in the collector, which makes me think the platform
might be platform-specific.

Is anyone successfully using SIGUSR2 to rotate Z2.log?


Steve McMahon wrote:
> I've been trying to figure out how to use SIGUSR2 for log rotation with 
> Zope 2.6.1, and am having no luck. The transcript below shows a sample 
> attempt to move Z2.log, create a new one, then use SIGUSR2 to get Zope 
> to reopen the log, hopefully with the new file. My event log indicates 
> that Zope's received the signal and it claims to have reopened the logs, 
> but the old, moved log is still being updated.
> 
> Note that using SIGHUP works. All this is happening on Zope 2.6.1, 
> FreeBSD 4.5, Python 2.1.3. Any ideas?
> 
> /var/db/zope261/var #mv Z2.log Z2.log.rotate
> /var/db/zope261/var #touch Z2.log; chmod 664 Z2.log
> /var/db/zope261/var #kill -USR2 `cat Z2.pid`
> /var/db/zope261/var #tail event.log
> ------
> 2003-02-24T08:47:20 INFO(0) Z2 Caught signal SIGUSR2
> ------
> 2003-02-24T08:47:20 INFO(0) Z2 Reopening log files
> ------
> 2003-02-24T08:47:20 INFO(0) Z2 Log files reopened successfully
> 
> [Zope activity]
> /var/db/zope261/var #ls -l Z2.log
> -rw-rw-r--  1   zope  0 Feb 24 08:46 Z2.log
> [note: old log file is still being updated.]
> 
> [now try SIGHUP, which works]
> /var/db/zope261/var #kill -HUP `cat *.pid`
> [Zope activity]
> /var/db/zope261/var #ls -l Z2.log
> -rw-rw-r--  1   zope  1545 Feb 24 08:48 Z2.log
> 
> 


-- 
______________________________________________________

Steve McMahon
Reid-McMahon, LLC
steve@reidmcmahon.com
steve@dcn.org