Hi all, I'm trying to extend the formatter for console logging with custom keys. But I've run into two problems while doing that:
1) Root log messages of course don't provide these custom keys in their extra dict, so they throw errors. Looking at the official Python documentation, it is possible to specify defaults for a formatter ( https://docs.python.org/3/library/logging.html#logging.Formatter), but Django doesn't support such a thing when trying to set it via the settings.py (as in: the formatters entry in the LOGGING specification in the settings.py doesn't support this). 2) So I looked into using that formatter only for my own log messages, for which I can control the extra dict passed to them. But it doesn't seem to be possible to provide two formatters for a single handler (kinda makes sense, since at that point, how would the handler choose the formatter?) But if I specify two different handlers of type logging.StreamHandler, only one of them seems to work (and the other handler's messages just aren't visible in the console output). Does anyone have a solution for this? If not, do people think it's worth requesting support for the defaults field for formatters specified in the settings.py LOGGING configuration? Thanks! -M -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALKNHcfyWJ8kQ2EZsF66MAOTaLEDjZT_VM2J%2BugUVPJHH8SS9w%40mail.gmail.com.