Using stacklevel with log.error produces this error. Ex:
logger = logging.getLogger('tcpserver')
logger.error("Connection problem", stack_info=sys.exc_info(), stacklevel=1)
While according to documentation: There are four keyword arguments in kwargs which are inspected: exc_info, stack_info, stacklevel and extra.
See https://docs.python.org/3/library/logging.html#logging.Logger.debug