one problem with the logging module when used in a repl environment like pythonista is that when you rerun a script, it creates a new logger instance... so you need to have some extra logic.

here is the little cookbook that i use in pythonista:

import logging, sys logger = logging.getLogger('myapp') if not logger.handlers: filehdlr = logging.FileHandler('myapp.txt','w') strmhandler = logging.StreamHandler(sys.stdout) formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') filehdlr.setFormatter(formatter) strmhandler.setFormatter(formatter) logger.addHandler(filehdlr) logger.addHandler(strmhandler) filehdlr.setLevel(logging.DEBUG) strmhandler.setLevel(logging.INFO) logger.setLevel(logging.DEBUG) % examples logger.debug('this gets logged to file only')'this shows to screen and file')