[Zope] SIGUSR2 on Solaris

Steve McMahon steve@reidmcmahon.com
Mon, 05 May 2003 08:22:22 -0700


In February, I reported the same problem on FreeBSD, but received no 
response when I asked if anyone else had the same problem.

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.

Note that using SIGHUP works. All this is happening on Zope 2.6.1, 
FreeBSD 4.5, Python 2.1.3.

 >
 > /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


Thierry FLORAC wrote:
>   Hi,
> 
> I try to make a log rotation on Zope-2.6.1 on Solaris.
> I just do :
> 
>   mv Z2.log Z2.log.0
>   kill -USR2 `cat Z2.pid`
> 
> My Zope events log say that log file have been reopened, but in fact Z2.log is 
> not created and log goes on in Z2.log.0
> The same thing works correctly with Zope-2.6.1 on Linux...
> 
> Any idea ?? I wouldn't like to have to restart Zope and flush all my caches to 
> make this rotation...
> Thanks,
> 
>   Thierry
> 

-- 
______________________________________________________

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