I'm using a config file to configure my logger in a Python application. This is the file:
[loggers]
keys=root
[logger_root]
level=INFO
handlers=console
[handlers]
keys=console,file_rotating
[handler_console]
class=StreamHandler
level=WARNING
formatter=console
args=(sys.stderr,)
[handler_file_rotating]
class=TimeRotatingFileHandler
level=DEBUG
formatter=file
args=('../logs/twicker.log', 'd', 1, 5)
[formatters]
keys=console,file
[formatter_console]
format=%(levelname)s - %(message)s
[formatter_file]
format=%(asctime)s - %(levelname)s - %(module)s - %(message)s
My problem is with TimeRotatingFileHandler. Everytime I run the app I get the next error:
ImportError: No module named 'TimeRotatingFileHandler'
What I'm doing wrong? I tried also changing class line to class=handlers.TimeRotatingFileHandler
but in that case I get the next error:
ImportError: No module named 'handlers'