[Freeipa-devel] [PATCH] along with stdout, stderr also log the initial command

John Dennis jdennis at redhat.com
Thu Nov 19 17:14:30 UTC 2009


Signed-off-by: John Dennis <jdennis at redhat.com>

along with stdout,stderr also log the initial command

This implements better logging of external commands. Formerly we were
just outputting stdout and stderr without labeling which was which. We
also omitted the initial command and it's arguments. This made it
difficult when reviewing the logs to know what the command was and
what was stdout vs. stderr. This patch fixes that.

---

 ipapython/ipautil.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index 47b651c..1066879 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -97,8 +97,9 @@ def run(args, stdin=None):
         p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
         stdout,stderr = p.communicate()
 
-    logging.info(stdout)
-    logging.info(stderr)
+    logging.info('args=%s' % ' '.join(args))
+    logging.info('stdout=%s' % stdout)
+    logging.info('stderr=%s' % stderr)
 
     if p.returncode != 0:
         raise CalledProcessError(p.returncode, ' '.join(args))


More information about the Freeipa-devel mailing list