@@ -214,15 +214,29 @@ def _dispose(self, mlist, msg, msgdata):
214214 msgid = msg .get ('message-id' , 'n/a' )
215215 filebase = msgdata .get ('_filebase' , 'unknown' )
216216
217+ # Log start of processing with enhanced details
218+ mailman_log ('debug' , 'OutgoingRunner._dispose: Starting to process message %s (file: %s) for list %s' ,
219+ msgid , filebase , mlist .internal_name ())
220+ mailman_log ('debug' , 'OutgoingRunner._dispose: Message details:' )
221+ mailman_log ('debug' , ' Message ID: %s' , msgid )
222+ mailman_log ('debug' , ' From: %s' , msg .get ('from' , 'unknown' ))
223+ mailman_log ('debug' , ' To: %s' , msg .get ('to' , 'unknown' ))
224+ mailman_log ('debug' , ' Subject: %s' , msg .get ('subject' , '(no subject)' ))
225+ mailman_log ('debug' , ' Message type: %s' , type (msg ).__name__ )
226+ mailman_log ('debug' , ' Message data: %s' , str (msgdata ))
227+ mailman_log ('debug' , ' Pipeline: %s' , msgdata .get ('pipeline' , 'No pipeline' ))
228+
217229 # Check retry count
218230 retry_count = msgdata .get ('_retry_count' , 0 )
219231 if retry_count >= self .MAX_RETRIES :
220- mailman_log ('error' , 'Message %s exceeded maximum retries' , msgid )
232+ mailman_log ('error' , 'OutgoingRunner._dispose: Message %s exceeded maximum retries (%d)' ,
233+ msgid , self .MAX_RETRIES )
221234 return False
222235
223236 with self ._processed_lock :
224237 if msgid in self ._processed_messages :
225- mailman_log ('error' , 'OutgoingRunner: Duplicate message detected: %s (file: %s)' , msgid , filebase )
238+ mailman_log ('error' , 'OutgoingRunner._dispose: Duplicate message detected: %s (file: %s)' ,
239+ msgid , filebase )
226240 return False
227241
228242 # Clean up old message IDs periodically
@@ -234,7 +248,7 @@ def _dispose(self, mlist, msg, msgdata):
234248 last_retry = self ._retry_times .get (msgid , 0 )
235249 time_since_last_retry = current_time - last_retry
236250 if time_since_last_retry < self .MIN_RETRY_DELAY :
237- mailman_log ('info ' , 'OutgoingRunner: Message %s (file: %s) retried too soon, delaying. Time since last retry: %d seconds' ,
251+ mailman_log ('debug ' , 'OutgoingRunner._dispose : Message %s (file: %s) retried too soon, delaying. Time since last retry: %d seconds' ,
238252 msgid , filebase , time_since_last_retry )
239253 # Requeue with delay
240254 self .__retryq .enqueue (msg , msgdata )
@@ -246,39 +260,43 @@ def _dispose(self, mlist, msg, msgdata):
246260
247261 try :
248262 # Log start of processing
249- mailman_log ('info ' , 'OutgoingRunner: Starting to process message %s (file: %s) for list %s' ,
263+ mailman_log ('debug ' , 'OutgoingRunner._dispose : Starting to process message %s (file: %s) for list %s' ,
250264 msgid , filebase , mlist .internal_name ())
251265
252266 # Validate message type first
253267 msg , success = self ._validate_message (msg , msgdata )
254268 if not success :
255- mailman_log ('error' , 'Message validation failed for outgoing message %s' , msgid )
269+ mailman_log ('error' , 'OutgoingRunner._dispose: Message validation failed for outgoing message %s' , msgid )
256270 with self ._processed_lock :
257271 self ._processed_messages .remove (msgid )
258272 return False
259273
260274 # Process the message through the delivery module
261275 try :
276+ mailman_log ('debug' , 'OutgoingRunner._dispose: Calling delivery module process function for message %s' , msgid )
262277 self ._func (mlist , msg , msgdata )
278+ mailman_log ('debug' , 'OutgoingRunner._dispose: Successfully processed message %s through delivery module' , msgid )
263279 except smtplib .SMTPException as e :
280+ mailman_log ('error' , 'OutgoingRunner._dispose: SMTP error processing message %s: %s' , msgid , str (e ))
264281 return self ._handle_smtp_error (e , mlist , msg , msgdata )
265282
266283 # Log successful completion
267- mailman_log ('info ' , 'OutgoingRunner: Successfully processed message %s (file: %s) for list %s' ,
284+ mailman_log ('debug ' , 'OutgoingRunner._dispose : Successfully processed message %s (file: %s) for list %s' ,
268285 msgid , filebase , mlist .internal_name ())
269286 return True
270287 except Exception as e :
271288 # Enhanced error logging with more context
272- mailman_log ('error' , 'Error processing outgoing message %s for list %s: %s' ,
289+ mailman_log ('error' , 'OutgoingRunner._dispose: Error processing outgoing message %s for list %s: %s' ,
273290 msgid , mlist .internal_name (), str (e ))
274- mailman_log ('error' , 'Message details:' )
291+ mailman_log ('error' , 'OutgoingRunner._dispose: Message details:' )
275292 mailman_log ('error' , ' Message ID: %s' , msgid )
276293 mailman_log ('error' , ' From: %s' , msg .get ('from' , 'unknown' ))
277294 mailman_log ('error' , ' To: %s' , msg .get ('to' , 'unknown' ))
278295 mailman_log ('error' , ' Subject: %s' , msg .get ('subject' , '(no subject)' ))
279296 mailman_log ('error' , ' Message type: %s' , type (msg ).__name__ )
280297 mailman_log ('error' , ' Message data: %s' , str (msgdata ))
281- mailman_log ('error' , 'Traceback:\n %s' , traceback .format_exc ())
298+ mailman_log ('error' , ' Pipeline: %s' , msgdata .get ('pipeline' , 'No pipeline' ))
299+ mailman_log ('error' , 'OutgoingRunner._dispose: Traceback:\n %s' , traceback .format_exc ())
282300
283301 # Remove from processed messages on error and requeue
284302 with self ._processed_lock :
0 commit comments