diff --git a/lib/ansible/utils/display.py b/lib/ansible/utils/display.py index 380f5b3327..fb4b5321a9 100644 --- a/lib/ansible/utils/display.py +++ b/lib/ansible/utils/display.py @@ -45,8 +45,8 @@ debug_lock = Lock() #TODO: make this a logging callback instead if C.DEFAULT_LOG_PATH: path = C.DEFAULT_LOG_PATH - if (os.path.exists(path) and not os.access(path, os.W_OK)) and not os.access(os.path.dirname(path), os.W_OK): - self._display.warning("log file at %s is not writeable, aborting\n" % path) + if (os.path.exists(path) and not os.access(path, os.W_OK)) or not os.access(os.path.dirname(path), os.W_OK): + print("[WARNING]: log file at %s is not writeable, aborting\n" % path, file=sys.stderr) logging.basicConfig(filename=path, level=logging.DEBUG, format='%(asctime)s %(name)s %(message)s') mypid = str(os.getpid())