Clean up logging

This logs only what is needed for diagnostics.  Much was diagnosing the
logging.
This commit is contained in:
Jigme Datse Yli-Rasku 2024-05-29 22:53:44 -07:00
parent 0881c1ce27
commit e0da11693a
2 changed files with 4 additions and 9 deletions

View File

@ -26,3 +26,4 @@ This is our current version trying to communicate between courier and mailman3.
* Date format set:
* Level and File set in variable
* Format had errors with `$` used instead of `%`
* Clean up logging to not log what was logged for logging diagnostics.

View File

@ -22,26 +22,20 @@ LEVEL=logging.INFO
LOGFILE='/opt/mailman/logs/courier-to-mailman.log'
logging.basicConfig(filename=LOGFILE, level=LEVEL, format=FORMAT, datefmt=DATEFMT)
logger.info('format set to: %s', FORMAT)
print('format set to: %s', FORMAT)
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
lmtp_host = sys.argv[3] if len(sys.argv) > 3 else 'localhost'
logger.info('lmtp_host: %s', lmtp_host)
# class smtplib.LMTP(host='', port=LMTP_PORT, local_hostname=None, source_address=None)
lmtp = smtplib.LMTP(lmtp_host, int(sys.argv[1]))
logger.info('lmtp_port: %s', sysv.arg[1])
lmtp = smtplib.LMTP(lmtp_host, int(sys.argv[1]))
logger.info('lmtp_port (lmtp setup): %s', sysv.arg[1])
try:
# Unfortunately qmail sends to local bare LF for end line, while