'app' may not have been initialized if an exception occurs, use logging.exception()
Merge pull request #421 from utkarshsins/fix-exception-print-01

'app' may not have been initialized if an exception occurs