The following code does print 'I want this to print' in 'ipython qtconsole', however it does not print in plain IPython.
import logging
import logging.handlers
log = logging.getLogger()
f = logging.Formatter("%(asctime)s - %(module)s. %(funcName)s - %(levelname)s - %(message)s")
fh = logging.handlers.TimedRotatingFileHandler('log.txt', 'W6')
fh.setFormatter(f)
log.addHandler(fh)
log.setLevel(logging.INFO)
log.info('I want this to print')
In 'IPython qtconsole' however i get different problems, that i tried to explain here (which did not go so well, no need to read!).
Can you please tell me why?
EDIT: I use Python 2.7
EDIT2: Maybe i really just need to add logging.StreamHandler.
log.txt
. I don't know why you think that the console should output on stdout... – Ioved