Dear all,
I am quite confused about the Python logging. I have read and re-read the Python documentation for the Python logging module and googled, but to no avail. I simply want one logger to log to a file and another logger to log to the console. Neither should log the other's messages. The following code causes fileLogger to log to BOTH a file and the console, how come? It seems to me that a call such as "consoleHandler = llogging.StreamHandler()" affects other loggers, which I do not want.
fileHandler = logging.FileHandler('../../logs/log.txt')
fileLogger = logging.getLogger('TESTHARNESSFILE')
fileLogger.addHandler(fileHandler)
fileLogger.setLevel(logging.INFO)
consoleHandler = logging.StreamHandler()
logger = logging.getLogger('TESTHARNESS')
logger.addHandler(consoleHandler)
logger.setLevel(logging.INFO)
Thanks for any help, I have spent so long trying to figure this out!