Message ID | 20180921172650.15703-1-stephen@that.guru |
---|---|
State | Accepted |
Headers | show |
Series | settings: Don't configure logging for parsearchive | expand |
On Fri, 2018-09-21 at 18:26 +0100, Stephen Finucane wrote: > 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@that.guru> > Fixes: 133091da ("parsearchive: Fix logging") > Cc: Daniel Axtens <dja@axtens.net> I've gone ahead and pushed this to hopefully fix the broken gate. Would still appreciate reviews as I plan to cherry-pick this back to stable/2.0 and stable/2.1. Stephen > --- > 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,
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,
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@that.guru> Fixes: 133091da ("parsearchive: Fix logging") Cc: Daniel Axtens <dja@axtens.net> --- patchwork/management/commands/parsearchive.py | 3 +-- patchwork/parser.py | 1 - patchwork/settings/base.py | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-)