Set all basic settings at the same time.
Let's see if this works.
This commit is contained in:
parent
98ba217d03
commit
0ae1a78050
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue