crossbario / autobahn-python

WebSocket and WAMP in Python for Twisted and asyncio
https://crossbar.io/autobahn
MIT License
2.48k stars 768 forks source link

Unpleasant amount of extra logging at info level arrives in 22.4.1 #1561

Closed cjw296 closed 2 years ago

cjw296 commented 2 years ago

Using autobahn with Twisted, as of 22.4.1 and above, this extra logging has appeared:

((<LogLevel=info>,
  '<unknown.> connection established for peer="tcp4:127.0.0.1:56444"'),
 (<LogLevel=info>,
  '<autobahn.twisted.websocket.WebSocketAdapterProtocol.connectionMade> '
  'connection established for peer="tcp4:127.0.0.1:33983"'),
 (<LogLevel=info>,
  '<autobahn.websocket.protocol.WebSocketServerProtocol.onConnect>: '
  "request={'extensions': [],\n"
  " 'headers': {'cache-control': 'no-cache',\n"
  "             'connection': 'Upgrade',\n"
  "             'host': '127.0.0.1:33983',\n"
  "             'pragma': 'no-cache',\n"
  "             'sec-websocket-key': 'ygJydDrmloOd4+dw1FuR0Q==',\n"
  "             'sec-websocket-version': '13',\n"
  "             'upgrade': 'WebSocket',\n"
  "             'user-agent': 'AutobahnPython/22.4.1'},\n"
  " 'host': '127.0.0.1',\n"
  " 'origin': '',\n"
  " 'params': {},\n"
  " 'path': '/v5',\n"
  " 'peer': 'tcp4:127.0.0.1:56444',\n"
  " 'protocols': [],\n"
  " 'version': 13}"),
...
 (<LogLevel=info>,
  'onConnect callback completed successfully with result=None'),

This feels excessive. How can we turn off or disable this new logging? At the very least, it should be logged at debug, but even so, it's extremely verbose and it would be great if there was a way to disable it completely...

oberstet commented 2 years ago

quick test, here is how that looks like with https://github.com/crossbario/autobahn-python/pull/1562 and log level "info" and a reconnecting client on Twisted: Bildschirmfoto von 2022-05-06 18-34-45

cjw296 commented 2 years ago

ccf4503 certainly appears to make this much better, when will it land in a release?

(Ideally we'd like these not to be sent at all, since the debug logging is still pretty heavy...)

oberstet commented 2 years ago

when will it land in a release?

once this PR is merged, any next release will contain it. there likely will be a 22.6.1 ..

we'd like these not to be sent at all

that's how it works already, as the txaio logger will make the log functions for non-active log levels a NoOp:

https://github.com/crossbario/txaio/blob/e00e3f079139dc32805fc595044138e1c0114f40/txaio/tx.py#L76 https://github.com/crossbario/txaio/blob/e00e3f079139dc32805fc595044138e1c0114f40/txaio/tx.py#L163