Skip to content

Instantly share code, notes, and snippets.

@benjiao
Created September 21, 2015 11:20
Show Gist options
  • Save benjiao/953c426267a80167c2fa to your computer and use it in GitHub Desktop.
Save benjiao/953c426267a80167c2fa to your computer and use it in GitHub Desktop.
Flask Logging to File Example
# Setup Logging
formatter = logging.Formatter('%(asctime)s %(levelname)-8s %(message)s')
fh = logging.FileHandler(filename='flask-tutorial.log')
fh.setFormatter(formatter)
fh.setLevel(logging.DEBUG)
app.logger.addHandler(fh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment