Another way would be to set up a receiver for a signal, emit a message via 
the logging module, configure LOGGING to log those messages to stderr.

Question for others: Is there a good document on what signals django sends?

Since I have it available, here's how you would adjust the LOGGING setting 
to send all messages up to the DEBUG level to stderr:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        },
        'console': {
                'level': 'DEBUG',
                'class': 'logging.StreamHandler',
        },
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
        '': {
            'handlers': ['console'],
            'level': 'DEBUG',
        },
    }
}


I added the 'console' handler and the '' (empty string) logger as 
differences from the default.

Of course, if you want to make your signal receiver send to a different 
logger name (eg: "request"), you only then have to have a logger for that:

        'request': {
            'handlers': ['console'],
            'level': 'INFO',
            'propagate': True,
        },


I dont have sample code for setting up the signal receiver, nor which 
> signal to receive even, handy. Perhaps someone else could help, there?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/GgHOfzuHvOYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to