When using logging module one often need to print traceback along with error message.

Solution is:

1
logger.error('error message', exc_info=True) # for adding traceback to log

Equivalent :

1
logger.exception('message')