Closed gilzig closed 5 years ago
Hi - should be possible, will have a look when I get home.
Thanks so much! Any update on this?
Ah, sorry, haven’t had time to look yet - will try to have a look this afternoon!
This is the code you need:
https://github.com/tintoy/seqlog/blob/development/v0.1/seqlog/__init__.py#L120
See also: _override_root_logger
function in the same file.
Thanks!
The following single line from your link actually did the trick:
logging.root = StructuredRootLogger(logging.DEBUG)
The only issue is that the console log is always displayed in red color since (I assume) the logs output is always redirected to stderr... To solve this, I added the lines as before (after the new code):
root_logger = logging.getLogger()
root_logger.addHandler(seqlog.structured_logging.ConsoleStructuredLogHandler())
Now there is no color per log type (error/warning/etc.) but at least everything is white and not red...
Thank you for your help!!
Gil
You’re welcome! Sorry for the delay in getting back to you - have been moving house and it’s been a little hectic :)
Description
I am using seq server as docker container. Sometimes, when someone in the group wants to debug locally, he does not have the seq container running. If I try to use the standard logger instead, I get format error, since the structured logging format is not the same as the standard logging one.
What I Did
I tried using the ConsoleStructuredLogHandler in the case where seq is not available:
but I still get the error saying:
Is there a way to bypass seq for local debug purposes?
Thank you very much, Gil