[Twisted-Python] twistd .tac and ILogObserver

Werner Thie wthie at thiengineering.ch
Fri Nov 21 01:15:18 EST 2008


Thank you so much, works like a charm!

Isn't this a snippet which could go into the FAQ about twistd? Or should 
there be a WIKI page about logging in general?

Werner

Christopher Armstrong wrote:
> On Thu, Nov 20, 2008 at 2:58 PM, Christopher Armstrong
> <radix at twistedmatrix.com> wrote:
>> On Thu, Nov 20, 2008 at 12:50 PM, Werner Thie <wthie at thiengineering.ch> wrote:
>>> Hi
>>>
>>> I tried to enhance my test.tac file with
>>>
>>>             :
>>> application = service.Application("test")
>>> application.setComponent(ILogObserver, LogFile('test.log', '/var/log/',
>>> rotateLength=10000).write)
>> You should not pass the write method as an observer: an observer must
>> be a callable that takes a dict.
>>
>> You probably want to import FileLogObserver from twisted.python.log,
>> and pass an instance of that:
>>
>> application.setComponent(ILogObserver,
>> FileLogObserver(LogFile("test.log", "/var/log", rotateLength=10000)))
> 
> Sorry, I didn't test this code. Change that to...
> 
> application.setComponent(ILogObserver,
> FileLogObserver(LogFile("test.log", "/var/log",
> rotateLength=10000)).emit)
> 
> maybe that code will work.
> 
> 




More information about the Twisted-Python mailing list