Why not using module logging?


#1

Or in other words, not logging anything even in debug mode in apistar? In my team we found a bug (or problem) and it forced us to add logging to our patched version of apistar. The bug does in certain situations (I could not reproduce all the hooks and components we use internally into a simple repro :disappointed: ) hangs on component Body as it failed the cache due to an exception thrown in a hook and then waiting for ASGI.receive forever on uvicorn, surprisingly it worked in test server, boomed in production. But real problems were swamped with no logs, as a tip some exceptions like binascii.Error and other bitches do not catch with except Exception and then all kind of unexpected can be expected.

For instance here:


and

Just adding a plain logger.debug(f"{sys.exc_info[0].__name__}: {sys.exc_info[1]}", exec_info=True) saved our day, swallowing errors could lead to edge cases when it’s almost impossible to debug what’s going on.

Additional logging for access or for known exceptions like the (apistar.exceptions.*) will also help a lot, it’s just a matter of importing the module and add apistar logger with DEBUG locally.