[Twisted-Python] Logging to both console and file (using twisted logging API)?

naman jain namanvit at gmail.com
Thu Oct 29 06:37:06 MDT 2009


Hi,

I wanted to log in a file and keep the console also going with it.

I am using
log.startLogging(open(logname, 'w'))

whatever documentation I could find about this API, it suggested me to pass
setStdout=False(in order to keep stdout away from putting into log)
somewhere in the startlogging function.

Something like this I tried:
log.startLogging(sys.stdout,setStdout=False)

Doesnt help in solving the problem of getting both things:

Requirement:
log.msg("messageforlog")    -> goes to log
print "message for console" -> goes to console

Could anyone give some ideas on this?

Regards
Naman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20091029/359f0a14/attachment.html>


More information about the Twisted-Python mailing list