diff --git a/docs/courier-to-mailman3.md b/docs/courier-to-mailman3.md index f1859d3..e758ec8 100644 --- a/docs/courier-to-mailman3.md +++ b/docs/courier-to-mailman3.md @@ -19,4 +19,9 @@ This is our current version trying to communicate between courier and mailman3. * This is not working * Reverting to previous formatting * No idea what steps we've gone through to get here. -* Let's try again. \ No newline at end of file +* Let's try again. +* OK, basicSettings all set at once. + * This sorts it, now let's get a date format working +* Now let's see if this works... + * Date format set: + * Level and File set in variable \ No newline at end of file diff --git a/source/courier-to-mailman3.py b/source/courier-to-mailman3.py index 7f4d2df..2ee44e7 100644 --- a/source/courier-to-mailman3.py +++ b/source/courier-to-mailman3.py @@ -14,9 +14,13 @@ import logging logger = logging.getLogger(__name__) -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) +# Format time and message +FORMAT = '%(asctime)s %(message)s' +# Set Date Format +DATEFMT = '%Y-$m-$d %H:%M:%S %Z' +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)