[Mailman-Developers] logging patch for SMTPDirect.py
Barry A. Warsaw
bwarsaw@beopen.com
Fri, 21 Jul 2000 22:38:47 -0400 (EDT)
>>>>> "RJ" == Ron Jarrell <jarrell@vt.edu> writes:
RJ> I posted patch 100861 to sourceforge; this addresses bug
RJ> 108167, which was the complaint that SMTPDirect.py didn't log
RJ> posts to the post log like Sendmail.py did. Since the
RJ> environment is a bit different (SMTPDirect can tell which user
RJ> had what error, Sendmail just kind of worked or went Blooie)
RJ> the "failure code" didn't seem to make sense; so I just had it
RJ> log a successful attempt at doing smtp dialog, and ignore
RJ> things that would just get the message thrown back into the
RJ> queue; they'll likely show up in other logs anyway.
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?
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: