Dev-Picayune

picayune: of little value or importance

Twisted Logging

For my own reference, since I couldn’t find what I was looking for online. It appears that the example in the Twisted Network Programming Essentials book regarding logging is missing something (or else I am). I was, of course, attempting to create a new service.Service that I would be using for Error Logging. I created my ErrLogService and ErrorLog classes the way it was in the book, but no additional log file appeared. So, I started looking around at it and I realized that nothing actually starts the service even though it was declared as a child of the application.

 application = service.Application('SPO Server', uid=1000,gid=1000)  dbConnection = adbapi.ConnectionPool(DB_DRIVER,**DB_ARGS) spoWebService = internet.TCPServer(8000, webserver.Site(RootResource(dbConnection))) spoWebService.setName("SPO_Web_Service") spoWebService.setServiceParent(application) errLogService = ErrLogService("spoerrors.log","./logs") errLogService.setName("SPO_Error_Log") errLogService.setServiceParent(application) errLogService.startServce() 

Without that last line, (errLogService.startService()), it doesn’t work, but with it, it works exactly as described in the book. (side note: I am using twistd to start the application)

Technorati Tags: ,

No comments

No comments yet. Be the first.

Leave a reply

For spam filtering purposes, please copy the number 3743 to the field below: