I am attempting to eventually set up django logging via a third-party service. For this I am using python-json-logger and setting up an appropriate formatter in the LOGGING dictionary in settings.py.
I believe I have it set up correctly, but when the formatter is enabled the first page I get after starting the app is a white screen with no content. After that, I can get pages. In no case am I getting anything in the log in response to URL requests. I am specifically testing with 404s. I've pared the formatter down to nothing (it just returns a static string) and the app still breaks when the formatter is specified. My immediate goal is to log data in the appropriate format to the console and then add in the third-party logging. Here is my LOGGING dictionary: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse' } }, 'formatters': { 'simple': { '()': 'jsonlogger.JsonFormatter', 'format': '%(levelname)s %(message)s' }, }, 'handlers': { 'console':{ 'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'simple' } }, 'loggers': { 'django': { 'handlers': ['console'], 'level': 'DEBUG', 'propagate': True, } } } jsonlogger has been pared all the way down to: import logging class JsonFormatter(logging.Formatter): def format(self, record): return "THIS IS A LOG MESSAGE" It is supposed to have a bit more, but I wanted to get the smallest code and still exhibit the issue. When I start the app, my startup messages are preceded by: THIS IS A LOG MESSAGE If I comment out the '()' in 'simple', any 404 I generate is logged on the console: WARNING Not Found: /fdsafdsafdaf and I never get any white screens. As soon as the formatter is enabled, I get a white screen on first access and no log to the console. Am I missing something obvious? Why am I getting a white screen? Why is there no log of what is going wrong? Thanks. -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.