I've 2 handlers to write to the console and the file:
import logging, sys
logger = logging.getLogger(__name__)
stdout_handler = logging.StreamHandler(sys.stdout)
logger.addHandler(stdout_handler)
file_handler = logging.FileHandler(filename="out.log")
logger.addHandler(file_handler)
if __name__ == '__main__':
    raise ZeroDivisionError
When exceptions happen StreamHandler made for stdout is able to log the traceback which came to the stderr. Meanwhile, FileHandler doesn't write a traceback to the file.
Am I missing something in the FileHandler setup? Is FileHandler able to log stderr (e.g. uncaught exceptions) at all?
 
     
    