logger.info(traceback.print_exc()) coming on python gui

logging, python

Solution

`print_exc` prints the stack trace to stderr.

Just use the exc_info=1 argument and it will automaticaly include the exception.

logging.exception("Exception") #or 
logging.error("exception ",exc_info=1) #or
logging.info("Exception has occured" ,exc_info=1)

Problem

When I execute `logger.info(traceback.print_exc())` the trace gets on console rather than in the log file I have `logger.propagate = False` also still the same issue

Original source