[Twisted-Python] Help with porting .tac-based custom logging to twisted plugin architecture
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Thu Oct 22 07:59:23 MDT 2009
On 21 Oct, 05:59 am, general at vultaire.net wrote:
>I have an app I'm working on, and until this point it's been done
>utilizing a .tac file. Recent changes in requirements are encouraging
>a
>change to use the Twisted plugin system instead. This seems clear for
>the most part, but I'm unsure about the logging.
>
>Specifically, in the .tac version, I'm using this:
>
> lf = logfile.DailyLogFile("my.log", ".")
> logname = "testlog"
> configure_python_logging(lf, logname)
> application.setComponent(log.ILogObserver,
> log.PythonLoggingObserver(logname).emit)
>
>However, in the plugin version, I'm not sure how to proceed since I
>don't have an application object. I can't seem to find any
>documentation for configuring logging with plugins, either. Is there a
>way to make this work?
This is a limitation of the implementation of twistd's plugin support.
tac files can define custom log observers. Plugins for twistd cannot.
Ticket #638 was originally for all of the custom logging feature, but it
was eventually split up and the tac parts moved to a separate ticket,
#3534, which is now resolved. #638 is still open, however. #3538 is
another related ticket which proposes an alternate solution to the
problem, allowing tacs and plugins to be used in combination.
Jean-Paul
More information about the Twisted-Python
mailing list