From 0ae1a78050a586251923b64e3f91ca29d0707c66 Mon Sep 17 00:00:00 2001 From: Jigme Datse Yli-Rasku Date: Wed, 29 May 2024 22:33:39 -0700 Subject: [PATCH] Set all basic settings at the same time. Let's see if this works. --- source/courier-to-mailman3.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/source/courier-to-mailman3.py b/source/courier-to-mailman3.py index 308c9c6..846b360 100644 --- a/source/courier-to-mailman3.py +++ b/source/courier-to-mailman3.py @@ -14,23 +14,15 @@ import logging logger = logging.getLogger(__name__) -## Changing how to handle this: -#logging.basicConfig(filename='/opt/mailman/logs/courier-to-mailman.log', level=logging.INFO) - -# File Logging -fh = logging.FileHandler(/opt/mailman/logs/courier-to-mailman.log') -fh.setLevel(logging.DEBUG) - -# Console Logging -ch = logging.StreamHandler() -ch.setLevel(logging.ERROR) - FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s' +DATEFMT = '%Y-$M-$d %H:%m:%S' +logging.basicConfig(filename='/opt/mailman/logs/courier-to-mailman.log', level=logging.INFO, format=FORMAT) + formatter = logging.Formatter(FORMAT) fh.setFormatter(formatter) ch.setFormatter(formatter) -logger..addHandler(fh) +logger.addHandler(fh) logger.addHandler(ch) logger.info('format set to: %s', FORMAT)