From f4c132ca5b373eaebf6c28057f3b9cfd6312716c Mon Sep 17 00:00:00 2001
From: Michael Friedrich <michael.friedrich@netways.de>
Date: Mon, 16 Dec 2013 16:22:22 +0100
Subject: [PATCH] Move command argument logging into the unix process class.

Refs #5225
---
 lib/base/process-unix.cpp | 5 ++++-
 lib/base/process.cpp      | 6 +-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/base/process-unix.cpp b/lib/base/process-unix.cpp
index b6b67d626..84228cb6b 100644
--- a/lib/base/process-unix.cpp
+++ b/lib/base/process-unix.cpp
@@ -27,6 +27,7 @@
 #include <boost/make_shared.hpp>
 #include <boost/foreach.hpp>
 #include <boost/thread/thread.hpp>
+#include <boost/algorithm/string/join.hpp>
 
 #ifndef _WIN32
 #include <execvpe.h>
@@ -67,6 +68,8 @@ ProcessResult Process::Run(void)
 #endif /* HAVE_PIPE2 */
 
 	// build argv
+	Log(LogDebug, "base", "Running command '" + boost::algorithm::join(m_Arguments, " ") + "'.");
+
 	char **argv = new char *[m_Arguments.size() + 1];
 
 	for (unsigned int i = 0; i < m_Arguments.size(); i++)
@@ -153,7 +156,7 @@ ProcessResult Process::Run(void)
 	int fd = fds[0];
 	(void) close(fds[1]);
 
-		char buffer[512];
+	char buffer[512];
 
 	std::ostringstream outputStream;
 
diff --git a/lib/base/process.cpp b/lib/base/process.cpp
index 6476dda75..1df048e38 100644
--- a/lib/base/process.cpp
+++ b/lib/base/process.cpp
@@ -21,17 +21,13 @@
 #include "base/process.h"
 #include "base/array.h"
 #include "base/objectlock.h"
-#include "base/logger_fwd.h"
 #include <boost/foreach.hpp>
-#include <boost/algorithm/string/join.hpp>
 
 using namespace icinga;
 
 Process::Process(const std::vector<String>& arguments, const Dictionary::Ptr& extraEnvironment)
 	: m_Arguments(arguments), m_ExtraEnvironment(extraEnvironment), m_Timeout(600)
-{
-	Log(LogDebug, "base", "Running command '" + boost::algorithm::join(arguments, " ") + "'.");
-}
+{ }
 
 std::vector<String> Process::SplitCommand(const Value& command)
 {