logrotation/logreopening in ZTK-based applications
Hi, Zope 2 provides a command to ask it to re-open its log files thus supporting outside logrotation. We have a ZTK-based app and found that the server provides neither signal handling to rotate logs nor a zopectl command. Does anybody remember wether this was ever built? I see an old discussion on the Python list (http://mail.python.org/pipermail/python-dev/2006-January/059566.html) but no conclusion. If this isn't in yet, does anybody know what the right place would be? (I guess the packages providing the main loops and configuring the process would be the right ones.) Christian -- Christian Theune · ct@gocept.com gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1 Zope and Plone consulting and development
On Wed, Nov 10, 2010 at 2:47 AM, Christian Theune <ct@gocept.com> wrote:
We have a ZTK-based app and found that the server provides neither signal handling to rotate logs nor a zopectl command. Does anybody remember wether this was ever built?
Christian, If you want size- or time-based rotation, that can be configured directly using ZConfig. There's a package called zc.signalhandler in the Zope Corporation repository that I'll be open-sourcing. It'll let you include something like this in your zope.conf: <signalhandlers myapp> usr2 ZConfig.components.logger.loghandler.reopenFiles </signalhandlers> That will let you re-open ZConfig-configured log files based on a signal. (The "myapp" is a turdly bit caused by using the same schema bits as <product-info> sections in the zope.conf schema.) -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> "A storm broke loose in my mind." --Albert Einstein
On 11/10/2010 02:23 PM, Fred Drake wrote:
On Wed, Nov 10, 2010 at 2:47 AM, Christian Theune<ct@gocept.com> wrote:
We have a ZTK-based app and found that the server provides neither signal handling to rotate logs nor a zopectl command. Does anybody remember wether this was ever built?
Christian,
If you want size- or time-based rotation, that can be configured directly using ZConfig.
There's a package called zc.signalhandler in the Zope Corporation repository that I'll be open-sourcing. It'll let you include something like this in your zope.conf:
<signalhandlers myapp> usr2 ZConfig.components.logger.loghandler.reopenFiles </signalhandlers>
That will let you re-open ZConfig-configured log files based on a signal. (The "myapp" is a turdly bit caused by using the same schema bits as<product-info> sections in the zope.conf schema.)
That's what I'm looking for - would be great if you found the time to release it. Christian -- Christian Theune · ct@gocept.com gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1 Zope and Plone consulting and development
On Wed, Nov 10, 2010 at 8:23 AM, I said:
There's a package called zc.signalhandler in the Zope Corporation repository that I'll be open-sourcing.
This is now available on svn.zope.org. The tests pass with Python 2.4, 2.5, 2.6, and 2.7. I've added a brief README.txt to show how it's used; there's a more extensive doctest inside the package. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> "A storm broke loose in my mind." --Albert Einstein
On 11/12/2010 06:22 AM, Fred Drake wrote:
On Wed, Nov 10, 2010 at 8:23 AM, I said:
There's a package called zc.signalhandler in the Zope Corporation repository that I'll be open-sourcing.
This is now available on svn.zope.org. The tests pass with Python 2.4, 2.5, 2.6, and 2.7.
I've added a brief README.txt to show how it's used; there's a more extensive doctest inside the package.
Cool, thanks! -- Christian Theune · ct@gocept.com gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1 Zope and Plone consulting and development
Hello Christian, Wednesday, November 10, 2010, 8:47:43 AM, you wrote: CT> Hi, CT> Zope 2 provides a command to ask it to re-open its log files thus CT> supporting outside logrotation. CT> We have a ZTK-based app and found that the server provides neither CT> signal handling to rotate logs nor a zopectl command. Does anybody CT> remember wether this was ever built? CT> I see an old discussion on the Python list CT> (http://mail.python.org/pipermail/python-dev/2006-January/059566.html) CT> but no conclusion. CT> If this isn't in yet, does anybody know what the right place would be? CT> (I guess the packages providing the main loops and configuring the CT> process would be the right ones.) I think ZTK should have a configurable log rotation built-in. Like: <logfile> path log.log formatter zope.exceptions.log.Formatter max-size 50MB old-files 5 </logfile> -- Best regards, Adam GROSZER mailto:agroszer@gmail.com -- Quote of the day: Criticism, like rain, should be gentle enough to nourish a man's growth without destroying his roots. - Frank A. Clark
On 11/10/2010 03:21 PM, Adam GROSZER wrote:
Hello Christian,
Wednesday, November 10, 2010, 8:47:43 AM, you wrote:
CT> Hi,
CT> Zope 2 provides a command to ask it to re-open its log files thus CT> supporting outside logrotation.
CT> We have a ZTK-based app and found that the server provides neither CT> signal handling to rotate logs nor a zopectl command. Does anybody CT> remember wether this was ever built?
CT> I see an old discussion on the Python list CT> (http://mail.python.org/pipermail/python-dev/2006-January/059566.html) CT> but no conclusion.
CT> If this isn't in yet, does anybody know what the right place would be? CT> (I guess the packages providing the main loops and configuring the CT> process would be the right ones.)
I think ZTK should have a configurable log rotation built-in. Like: <logfile> path log.log formatter zope.exceptions.log.Formatter max-size 50MB old-files 5 </logfile>
I'd like to keep this out of the server: rotation is a system administration task where I'd like to rely on the policies and tools provided by the system environment. Christian -- Christian Theune · ct@gocept.com gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1 Zope and Plone consulting and development
On 10/11/2010 14:23, Christian Theune wrote:
I'd like to keep this out of the server: rotation is a system administration task where I'd like to rely on the policies and tools provided by the system environment.
I just use logrotate's copytruncate option :-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk
participants (4)
-
Adam GROSZER -
Chris Withers -
Christian Theune -
Fred Drake