[Twisted-Python] Twistd problem with redirection

Phil Mayers p.mayers at imperial.ac.uk
Wed Oct 24 05:43:44 EDT 2007


On Wed, 2007-10-24 at 07:57 +0200, Roland Hedberg wrote:
> Hi!
> 
> I've encountered a strange problem which I'd like to have some help with.
> 
> I'm building some software using Twisted and have encountered the
> following problem.
> 
> I use twistd 2.5.0 and starts the server using:
> 
> twistd pyom --logfile=x.log ...
> 
> Now, the tap file that is run by twistd loads and initiates modules
> dependent on the configuration. And these modules might load other modules.
> 
> So, what happens is that, depending (looks like it) on how complex the
> setup is, the redirect of stdout output for print to the logfile is not
> universally done.

I've never seen that.

> 
> Consistent but depending on the configuration, the output from print for
> one of modules continues to go to stdout instead of to the logfile.

Can you produce a minimal example showing the effect?

> 
> Anyone got a clue as to what is happening and what I can do about it ?


sed -i -e 's/print \(.*\)/log.msg(\1)/g' *.py

i.e. don't use "print" for logging.

> 
> -- Roland
> 
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python





More information about the Twisted-Python mailing list