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

@ -11,3 +11,4 @@ This is our current version trying to communicate between courier and mailman3.
* Which I screwed up. I think I was typing in the wrong window. * Which I screwed up. I think I was typing in the wrong window.
* It's not failing on command line. * 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 # $3 LMTP Host
# std_in message text # std_in message text
try:
import logging import logging
import os
import sys
import smtplib
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logging.basicConfig(filename='~/logs/courier-to-mailman.log', level=logging.INFO) logging.basicConfig(filename='/opt/mailman/logs/courier-to-mailman.log', level=logging.INFO)
FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s' FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'
logging.basicConfig(format=FORMAT) logging.basicConfig(format=FORMAT)
logger.info('Starting Logging') logger.info('Starting Logging (outside try)')
print('Starting Logging (outside try)')
try:
import os
import sys
import smtplib
logger.info('Starting Logging (inside try)')
print('Starting Logging (inside try)')
# Setup LTMP connection # Setup LTMP connection
lmtp_host = sys.argv[3] if len(sys.argv) > 3 else 'localhost' lmtp_host = sys.argv[3] if len(sys.argv) > 3 else 'localhost'