Skip to content

Instantly share code, notes, and snippets.

@svetlyak40wt
Created May 24, 2010 08:17
Show Gist options
  • Save svetlyak40wt/411648 to your computer and use it in GitHub Desktop.
Save svetlyak40wt/411648 to your computer and use it in GitHub Desktop.
How to set python logging with comprehensive format.
import logging
root = logging.getLogger()
handler = logging.FileHandler('debug.log')
fmt = logging.Formatter('%(asctime)s %(process)s/%(thread)s %(levelname)s %(name)s %(filename)s:%(lineno)s %(message)s')
handler.setFormatter(fmt)
root.addHandler(handler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment