Reputation: 57
I followed the documentation as carefully, but somehow creating the handler doesnt seem to be working.
import logging
import logging.handlers
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
# create handlers and set levels
qaHandler = logger.addHandler(logging.handlers.TimedRotatingFileHandler('%sQA.log'%__name__,when='midnight', backupCount=3))
qaHandler.setLevel(logging.INFO)
Thats the code, what have I missed?
Upvotes: 2
Views: 4385
Reputation: 14404
addHandler()
does not return the handler but None
. Put the handler into a variable, then use the variable to add it.
Upvotes: 4