Moving Logging and adding prints.

This commit is contained in:
Jigme Datse Yli-Rasku 2024-05-29 21:44:19 -07:00
parent f095619494
commit f3a169208b
2 changed files with 15 additions and 10 deletions

View File

@ -10,4 +10,5 @@ This is our current version trying to communicate between courier and mailman3.
* Second change is to have the `#!` path hopefully pointing in the right place.
* Which I screwed up. I think I was typing in the wrong window.
* It's not failing on command line.
* Still failing, let's get some logging.
* Still failing, let's get some logging.
* Moved logging initialization, and included print statements

View File

@ -11,20 +11,24 @@
# $3 LMTP Host
# std_in message text
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(filename='/opt/mailman/logs/courier-to-mailman.log', level=logging.INFO)
FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'
logging.basicConfig(format=FORMAT)
logger.info('Starting Logging (outside try)')
print('Starting Logging (outside try)')
try:
import logging
import os
import sys
import smtplib
logger = logging.getLogger(__name__)
logging.basicConfig(filename='~/logs/courier-to-mailman.log', level=logging.INFO)
FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'
logging.basicConfig(format=FORMAT)
logger.info('Starting Logging')
logger.info('Starting Logging (inside try)')
print('Starting Logging (inside try)')
# Setup LTMP connection
lmtp_host = sys.argv[3] if len(sys.argv) > 3 else 'localhost'