You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since >= 24.6 where logging was overhauled, it is nearly impossible to recover the pre-24.6 behaviour for logging if LogRecord has additional fields. They are getting logged as extra lines when mode is debug. I managed to make it work correctly for non-debug mode.
Tried setting SANIC_LOG_EXTRA=false , doesn't seem to work as this value seems to be sometimes read but also is written by Sanic itself in sanic/logging/setup.py.
I then noticed that setup_logging has a log_extra param which is by default set using the deployment mode. But in some cases depending on how the service is run, the third parameter is also passed.
Is there an existing issue for this?
Describe the bug
Since >= 24.6 where logging was overhauled, it is nearly impossible to recover the pre-24.6 behaviour for logging if
LogRecord
has additional fields. They are getting logged as extra lines when mode isdebug
. I managed to make it work correctly fornon-debug
mode.Tried setting
SANIC_LOG_EXTRA=false
, doesn't seem to work as this value seems to be sometimes read but also is written by Sanic itself insanic/logging/setup.py
.I then noticed that
setup_logging
has alog_extra
param which is by default set using the deployment mode. But in some cases depending on how the service is run, the third parameter is also passed.I think the latter should also obey the
self.config.NO_COLOR
parameter for consistency.Code snippet
No response
Expected Behavior
I expect a clear way of disabling this
LOG_EXTRA
feature either from the environment or through other mechanisms.How do you run Sanic?
Sanic CLI
Operating System
Linux
Sanic Version
24.12
Additional context
No response
The text was updated successfully, but these errors were encountered: