[Twisted-Python] twisted.logger and log filtering in twistd plugin

Werner Thie werner at thieprojects.ch
Mon Feb 1 10:20:54 MST 2016


On 2/1/16 4:45 AM, Patryk Ściborek wrote:
> Hi Guys!
>
> I'm using twisted.logger in my new app. I'm running it as a twistd
> plugin and I don't know how to enable log message filtering. I know that
> twistd still uses twisted.python.log but I have to disable debug
> messages somehow. What's the best way to do that in my ServiceMaker?
>
> Best regards,
> Patryk
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>

Hello Patryk

That's what I'm using in my .tac files:

from twisted.python import log
from twisted.python.log import ILogObserver, FileLogObserver

     :
service = service.Application(myPackage)
service.setComponent(ILogObserver, FileLogObserver(LogFile('myLog.log', 
'/var/log', rotateLength=10000)).emit)

Hope this helps, Werner




More information about the Twisted-Python mailing list