[PATCH] settings: Don't configure logging for parsearchive

Stephen Finucane stephen at that.guru
Sat Sep 22 03:26:50 AEST 2018


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 <stephen at that.guru>
Fixes: 133091da ("parsearchive: Fix logging")
Cc: Daniel Axtens <dja at axtens.net>
---
 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 e8904112..37db2b0d 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 verbosity < 3 and (i % 10) == 0:
                 self.stdout.write('%06d/%06d\r' % (i, count), ending='')
diff --git a/patchwork/parser.py b/patchwork/parser.py
index eb78702f..2ba1db74 100644
--- a/patchwork/parser.py
+++ b/patchwork/parser.py
@@ -1153,7 +1153,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 3eb1f0e2..1a62404f 100644
--- a/patchwork/settings/base.py
+++ b/patchwork/settings/base.py
@@ -185,7 +185,7 @@ LOGGING = {
             'level': 'WARNING',
             'propagate': False,
         },
-        'patchwork.management.commands': {
+        'patchwork.management.commands.parsemail': {
             'handlers': ['console', 'mail_admins'],
             'level': 'WARNING',
             'propagate': True,
-- 
2.17.1



More information about the Patchwork mailing list