﻿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
17281	AdminErrorHandler silently fails if the log message contains newlines	Russell Keith-Magee	marw85	"If you have loggers configured with an django.utils.log.AdminEmailHandler, and you log a message that has a newline in it, the log message is handled by the logger, but is silently discarded. 

For example if you sent the following:
{{{
logger.error('This is a\n test message')
}}}

The log message will be correctly written to any text-based log handlers or console log handlers, but the AdminEmailHandler silently fails. 

This is because the subject of an email can't contain newlines. 

Given that the AdminEmailHandler is intended as a mechanism for reporting serious errors, it's pretty bad that it can fail silently due to the contents of the message it's reporting. The ""subject"" of the log email should be cleansed of newlines before the call to mail_admins is made.

This cleansing could also be performed in the mail utilities themselves. However, I'm not convinced this is the right place; the general mail tools have ""fail_silently"" as an option, so it would be possible to handle this error in a better way. Failing is not an option during logging, so we should make sure that the messages to be sent are appropriately cleansed."	Bug	closed	Core (Other)		Normal	fixed		glencoates iacobcatalin@…	Ready for checkin	1	0	0	0	1	0
