Python logging: disable stack trace
Is there a simple way to disable the logging of an exception stack trace in Python 3, either in a Handler or Formatter ? I need the stack trace in another Handler , so setting exc_info=False , in the call to the Logger is not an option. Is there a simpler way than just defining my own Formatter ? The easiest option to disable per handler traceback output is to add a custom logging.Filter subclass that alters the record object (rather than filter out records). The filter simply has to set exc_info on records to None : class TracebackInfoFilter(logging.Filter): """Clear or restore the exception