[Twisted-Python] twistd .tac and ILogObserver

Christopher Armstrong radix at twistedmatrix.com
Thu Nov 20 13:33:09 MST 2008


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.


-- 
Christopher Armstrong
http://radix.twistedmatrix.com/
http://planet-if.com/
http://canonical.com/




More information about the Twisted-Python mailing list