[Mailman-Developers] logging patch for SMTPDirect.py

Dan Mick Dan Mick <Dan.Mick@West.Sun.COM>
Fri, 21 Jul 2000 19:50:34 -0700 (PDT)


> Since SMTPDirect.py already writes to logs/smtp, I didn't think it was
> necessary to also write to logs/post.  I gather from your patch and
> Dan's bug report that you think it should do both?  Or should it write
> only to logs/post?

The one in 'post' was the one I was interested in; the "from who, size
who" form allows me to more-easily track messages through various queues,
assess delivery delays, etc.

It just looked different from the other delivery methods, and it
was a new change to me when I started using SMTPDirect (2.0, probably).

> 
> As for the success/failure bit, you're right, the failure code doesn't
> make much sense here.  What probably does make sense is for on
> failure, to print the number of failed recipients.
> 
> So along those lines, here's what I intend to check in.
> 
> -Barry
> 
> -------------------- snip snip --------------------
> Index: SMTPDirect.py
> ===================================================================
> RCS file: /cvsroot/mailman/mailman/Mailman/Handlers/SMTPDirect.py,v
> retrieving revision 1.11
> diff -u -r1.11 SMTPDirect.py
> --- SMTPDirect.py	2000/06/03 04:59:45	1.11
> +++ SMTPDirect.py	2000/07/22 02:36:53
> @@ -75,9 +75,19 @@
>      finally:
>          t1 = time.time()
>          mlist.Lock()
> -    # Process any failed deliveries.
> +    # Log the successful post
>      syslog('smtp', 'smtp for %d recips, completed in %.3f seconds' %
>             (len(recips), (t1-t0)))
> +
> +    if refused:
> +        syslog('post', 'post to %s from %s, size=%d, %d failures' %
> +               (mlist.internal_name(), msg.GetSender(), len(msg.body),
> +                len(refused)))
> +    else:
> +        syslog('post', 'post to %s from %s, size=%d, success' %
> +               (mlist.internal_name(), msg.GetSender(), len(msg.body)))
> +
> +    # Process any failed deliveries.
>      tempfailures = []
>      for recip, (code, smtpmsg) in refused.items():
>          # DRUMS is an internet draft, but it says:
> 
> 
> _______________________________________________
> Mailman-Developers mailing list
> Mailman-Developers@python.org
> http://www.python.org/mailman/listinfo/mailman-developers