Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Setting Up Basic Logging

DZone's Guide to

Setting Up Basic Logging

·
Free Resource
import logging
logger = logging.getLogger('app')
handler = logging.FileHandler('app.log')
formatter = logging.Formatter('%(asctime)s %(levelname)5s %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler) 
logger.setLevel(logging.INFO)
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}