I'd suggest using lock.exception() here - it automatically adds the traceback to the logged message.