﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31424	django.utils.log.AdminEmailHandler won't include stack trace when django.server logs are propogated	Wesley Ellis	nobody	"If I configure LOGGING such that logger has the propagate property set to True, the AdminEmail handler no longer contains a stack trace.

I can reproduce with the following changes to settings.py for a brand new django app here: https://github.com/wesleyjellis/django_bug/commit/3994f74b57ecdec95c91fc322a64ce08887de2cc

{{{

EMAIL_BACKEND = ""django.core.mail.backends.console.EmailBackend""

ADMINS = [('Test', 'test@example.com')]

LOGGING = {
    ""version"": 1,
    ""disable_existing_loggers"": False,
    ""handlers"": {
        ""console"": {
            ""level"": ""INFO"",
            ""class"": ""logging.StreamHandler"",
        },
        ""mail_admins"": {
            ""level"": ""ERROR"",
            ""class"": ""django.utils.log.AdminEmailHandler"",
        },
    },
    ""loggers"": {
        ""django"": {""handlers"": [""console"", ""mail_admins""], ""level"": ""INFO"",},
        ""django.server"": {
            ""handlers"": [""console""],
            ""level"": ""INFO"",
            ""propagate"": True, # If this is True, AdminEmailHandler gets a record where record.request is a socket
        },
    },
}

}}}

The stack trace seems to be coming from the `technical_500` templates, but those templates don't include the stack frame if there is no request: https://github.com/django/django/blob/master/django/views/templates/technical_500.txt#L3

The request is set here: https://github.com/django/django/blob/master/django/utils/log.py#L9

But for some reason I don't understand, `record.request` is a socket object when {{{propagate: True}}}

I've attached the logs for both cases here: https://github.com/wesleyjellis/django_bug/commit/baa912ead8cc6f8dee1b6a69d6b5ff2cf133ef71"	Bug	closed	Uncategorized	3.0	Normal	invalid			Unreviewed	0	0	0	0	0	0
