gevent-websocket - How to add request logging?

123 views
Skip to first unread message

neoCogent

unread,
Aug 14, 2015, 4:23:58 AM8/14/15
to gevent: coroutine-based Python network library
Not sure if this is the best place to ask but it is indicated on the gevent-websocket github as a place to go ask questions.

I'm using gevent-websocket as a server for both a regular Web/API and a websocket. This works well as it is a sublcass of WSGIServer anyway and the ability to attach Resources is clean.

But it also disables any logging except when debug is enabled. I can understand not logging websocket traffic, but I'd like to get back the logging that usually occurs with regular WebAPI access, ie. the regular "application" resources.

I cannot find an easy way to do this. I guess I could subclass WebSocketServer or the WebSocketHandler and rewrite the parts relating to logging. After messing around with trying to force in a new logger, eg.

server.logger = logging.getLogger().addHandler(logging.StreamHandler())

I gave up with no change in logging output. Logging to stderr is fine because I am using a daemon context which routes this to a given log file anyway. The default WSGIServer inserts server handling time, which is something I'd like to get back.

So, does anyone know how to do this? Is there a simple way I've missed?
Thx.
Reply all
Reply to author
Forward
0 new messages