[Twisted-Python] Custom log "files" with twisted.logger
Jean-Paul Calderone
exarkun at twistedmatrix.com
Wed Jun 14 06:53:30 MDT 2017
Hello,
I would like to be able to send events from the new logging system
(twisted.logger) to a remote log collection system. If I'm using twist then
it seems options for configuring this part of logging are limited. The
choices appear to be logging to stdout, stdout, or a file on the filesystem.
If I write my own command-line entrypoint then I can probably do whatever I
want by writing a custom observer and hooking it up appropriately. I'd
rather not have to do that, though.
I could also go back to twistd and use --logger. But since interest in
twistd appears to be on the decline, in favor of twist, I'd rather avoid
that as well.
It seems like the idea would be something like --logger for twist, perhaps
replacing the --log-file option. If there were a way to pass some
arguments that would be pretty nice as well.
twist --logger myapp.something:x=y,a=b
twist --logger twisted.logger.FileLogObserver.fromPath:path=/foo/bar
(Actual syntax not that important to me; consistency with endpoint syntax
would have some advantages; something that deals with the necessities of
quoting and nesting would be better, of course. Also, I know everyone
hates Twisted's plugins but they would make for a nicer UI than FQPNs here.)
The first thing I'm likely to do with this is bridge twisted.logger events
to Eliot. I think this will provide the most useful logs (at least *some* of
the logs from Twisted will have a meaningful Eliot context, though
certainly nowhere near all). Also I already have a system for configuring
Eliot log destinations (which supports passing along arguments, so I can
already tell Eliot where my remote log collector is with a command-line
argument).
What are the chances of getting support for this scenario into twist itself?
Thanks,
Jean-Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20170614/93face1b/attachment.html>
More information about the Twisted-Python
mailing list