[Twisted-Python] Different logging class for .tac file run by twistd

Thomas Hervé therve at free.fr
Wed Apr 25 07:59:21 EDT 2007


Quoting Thomas Jacob <jacob at internet24.de>:

> I would like to replace the default logger of
> twistd with my own (a version of DailyLogFile).
>
> Now it's possible to use startLogging just like
> in a stand-alone twisted app, but twistd will
> still start the standard logger (twistd.log),
> so now I have two different log files.
>
> <.tac-file>
> ....
> application = service.Application("someapp")
> ...
> web = internet.TCPServer(1234, server.Site(..))
> web.setServiceParent(application)
>
> log.startLogging(DailyLogFile(LOG_FILE, LOG_DIR, LOG_MODE))
> <end .tac-file>
>
> Any hints how to prevent the second, default
> twistd log file?


Currently, the only way I know is to do this:

from twisted.python import log
log.theLogPublisher.observers.pop(0)

Now, this is one of the thing that should be fixed for the next release 
(I hope)
with http://twistedmatrix.com/trac/ticket/638

-- 
Thomas







More information about the Twisted-Python mailing list