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

Stephen Finucane stephen at that.guru
Thu Sep 27 05:38:55 AEST 2018


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 at that.guru>
> Fixes: 133091da ("parsearchive: Fix logging")
> Cc: Daniel Axtens <dja at 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,




More information about the Patchwork mailing list