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

@ -25,4 +25,5 @@ This is our current version trying to communicate between courier and mailman3.
* Now let's see if this works... * Now let's see if this works...
* Date format set: * Date format set:
* Level and File set in variable * Level and File set in variable
* Format had errors with `$` used instead of `%` * 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' LOGFILE='/opt/mailman/logs/courier-to-mailman.log'
logging.basicConfig(filename=LOGFILE, level=LEVEL, format=FORMAT, datefmt=DATEFMT) 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: try:
import os import os
import sys import sys
import smtplib import smtplib
logger.info('Starting Logging (inside try)') 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'
logger.info('lmtp_host: %s', lmtp_host) logger.info('lmtp_host: %s', lmtp_host)
# class smtplib.LMTP(host='', port=LMTP_PORT, local_hostname=None, source_address=None) # 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]) 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: try:
# Unfortunately qmail sends to local bare LF for end line, while # Unfortunately qmail sends to local bare LF for end line, while