Let's get this working
Or let's see if we can... This is a far more complex version with conslole logging, and file logging. But hopefully it gives us formatting.
This commit is contained in:
parent
7baad18daf
commit
98ba217d03
|
@ -19,3 +19,4 @@ 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.
|
|
@ -14,12 +14,24 @@
|
|||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
logging.basicConfig(filename='/opt/mailman/logs/courier-to-mailman.log', level=logging.INFO)
|
||||
## 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'
|
||||
formatter = logging.Formatter(FORMAT)
|
||||
logger.setFormatter(formatter)
|
||||
fh.setFormatter(formatter)
|
||||
ch.setFormatter(formatter)
|
||||
|
||||
logger..addHandler(fh)
|
||||
logger.addHandler(ch)
|
||||
|
||||
logger.info('format set to: %s', FORMAT)
|
||||
print('format set to: %s', FORMAT)
|
||||
|
|
Loading…
Reference in New Issue