From 92ccdeb85118c59d1c0a3481aee89a9e455bcca4 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 21 Sep 2018 17:59:48 +0100 Subject: [PATCH] settings: Don't configure logging for parsearchive A recent change added additional ERROR level logs to the 'parsearchive' tool. This highlighted an issue, whereby we had configured all modules in 'patchwork.management.command' to email administrators on ERROR logs. We clearly shouldn't be doing this for the 'parsearchive' command or for anything other than 'parsemail', so fix this. Along the way, we remove a now-unnecessary 'extra' argument to one of the logging calls in 'parsearchive' and resolve a pep8 issue. Signed-off-by: Stephen Finucane Fixes: 133091da ("parsearchive: Fix logging") Cc: Daniel Axtens (cherry picked from commit aa266a28c6a022ad6952fac8f36afff0c540dccf) --- patchwork/management/commands/parsearchive.py | 3 +-- patchwork/parser.py | 1 - patchwork/settings/base.py | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/patchwork/management/commands/parsearchive.py b/patchwork/management/commands/parsearchive.py index bffb4647..4e2bb46a 100644 --- a/patchwork/management/commands/parsearchive.py +++ b/patchwork/management/commands/parsearchive.py @@ -97,8 +97,7 @@ class Command(BaseCommand): logger.warning('Duplicate mail for message ID %s', exc.msgid) except (ValueError, Exception) as exc: errors += 1 - logger.warning('Invalid mail: %s', exc.message, - extra={'mail': mail.as_string()}) + logger.warning('Invalid mail: %s', exc.message) if (i % 10) == 0: self.stdout.write('%06d/%06d\r' % (i, count), ending='') diff --git a/patchwork/parser.py b/patchwork/parser.py index 1304e95e..a4762dbb 100644 --- a/patchwork/parser.py +++ b/patchwork/parser.py @@ -1175,7 +1175,6 @@ def parse_mail(mail, list_id=None): author = get_or_create_author(mail) - try: comment = Comment.objects.create( submission=submission, diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py index 45c66da7..23b9fc95 100644 --- a/patchwork/settings/base.py +++ b/patchwork/settings/base.py @@ -193,7 +193,7 @@ LOGGING = { 'level': 'DEBUG', 'propagate': False, }, - 'patchwork.management.commands': { + 'patchwork.management.commands.parsemail': { 'handlers': ['console', 'mail_admins'], 'level': 'INFO', 'propagate': True, -- 2.47.3