[Twisted-Python] twistd save state does not work

Jean-Paul Calderone exarkun at divmod.com
Fri Sep 29 12:07:07 EDT 2006

On Fri, 29 Sep 2006 16:53:10 +0200, Remi Cool <mailinglists at smartology.nl> wrote:
>Remi Cool wrote:
>>I've readied my app for use with twistd, the daemonizing works, but a tap 
>>file is not saved upon exit (kill 'cat twisted.pid'). How can I enable the 
>>save state option? BTW I'm not using the -o option with twistd ;)
>>Second ... is it possible to disable the twisted logging if you use twistd 
>>to start the app? Or is it possible to set a log level so that only 
>>warnings and errors are shown and my log is not flooded with (TCPServer) 
>>connection messages.
>The save state function only seems to work when you start with a tap in the 
>firstplace. It then saves the state in appname-shutdown.tap ... ok but why 
>doesn't it work when you start from a python file?

It's implicitly disabled when loading an application from a Python file,
since there is no guarantee that the application will be serializable.

There is no way to explicitly re-enable it.  I would suggest that this
feature be added, but since most people seem to think tap files should
be eliminated as soon as possible, pursuing this would probably involve
a lot of debate that I'm not personally interested in participating in.

I would suggest using an alternate mechanism for persistence.

>My 2nd question about the logging still stands ...

It's not, although it certainly should be.  I believe there is at least
one ticket open in the tracker for improving the logging features of

> and is it possible to 
>(re)set the name of the log file in the python file where application is 
>defined? I have all paths for the app in an ini file (configParser) and it 
>would not be a good solution to declare the logfile path somewhere else.

The next release of Twisted will include a much more extensible way to
interact with twistd which should satisfy this use-case.  If you want
to play with it in svn trunk at HEAD, you can take a look at the output of
`twistd --help'.  The command list which shows up at the end of that
output can be extending using the plugin system, so you can add your
command, which sets up logging or loads configuration from an ini, or
whatever else you like.


More information about the Twisted-Python mailing list