[Zope] How to rotate the Z2.log log file
Martijn Pieters
mj@antraciet.nl
Mon, 20 Sep 1999 13:47:52 +0200
At 12:51 20/09/99 , smoerk@gmx.de wrote:
>But I don't know how I could modify ZServer that a SIGHUP will reopen
>files.
>
>On Fri, 17 Sep 1999 14:46:38 -0400, Christopher Petrilli wrote:
>
> >> I don't want that Zope does it for me, and a cron job is fine, but I
> >> don't know how I could do it. If I rename the file, ZServer doesn't
> >> create a new one, but uses the renamed (Apache does the same). But
> >> restarting Zope is not a solution, too. Any ideas?
> >
> >What needs to happen is that you have to get Zope to close it's log files
> >and reopen them. It doesn't (as with all UNIX software) track based on
> >name, but on inode/fd map information. If you send Apache a SIGHUP it'll
> >close and reopen them. ZServer should do the same, but it doesn't. This is
> >a good patch opportunity ;-)
> >
> >Chris
Medusa (on which ZServer is based) also supports rotating logfiles by itself.
If you change line 409 of z2.py to:
lg = logger.rotating_file_logger(LOG_PATH, freq='daily')
your log files will be rotated on a daily basis. You could also rotate
'weekly', and 'monthly', or you could specify maxsize=<num_of_bytes>
instead of freq=xxx, where <num_of_bytes> is the size of logfile at which
to rotate it.
--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------