Revert "AMBARI-24270. Agent Status Command Are Randomly Failing With Empty stderr (aonishuk) (#1728)"

This reverts commit 219a23623349bc3715f6c667369477bd32ef1b0b.
diff --git a/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py b/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py
index 65af9b0..5d20495 100644
--- a/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py
+++ b/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py
@@ -136,7 +136,7 @@
     if status == LiveStatus.DEAD_STATUS:
       stderr = component_status_result['stderr']
       if not "ComponentIsNotRunning" in stderr and not "ClientComponentHasNoStatus" in stderr:
-        logger.info("Status command for {0} failed ({1}) :\n{2}".format(component_name, component_status_result, stderr))
+        logger.info("Status command for {0} failed:\n{1}".format(component_name, stderr))
 
     result = {
       'serviceName': service_name,
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index bcb3e9b..51a0d59 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -326,7 +326,6 @@
 
     try:
       command = self.generate_command(command_header)
-      logger.info("Generated command")
       script_type = command['commandParams']['script_type']
       script = command['commandParams']['script']
       timeout = int(command['commandParams']['command_timeout'])
@@ -340,8 +339,6 @@
         command_name = command['roleCommand']
       else:
         task_id = 'status'
-        
-      logger.info("[{0}]".format(task_id))
 
       if forced_command_name is not None:  # If not supplied as an argument
         command_name = forced_command_name
@@ -425,18 +422,11 @@
         if log_out_files:
           script_params.append("-o")
 
-        logger.info("[{0}] python_executor.run_file({1})".format(task_id, (py_file, script_params,
-                               tmpoutfile, tmperrfile, timeout,
-                               tmpstrucoutfile, self.map_task_to_process,
-                               task_id, override_output_files, backup_log_files,
-                               handle, log_info_on_failure)))
-                               
         ret = python_executor.run_file(py_file, script_params,
                                tmpoutfile, tmperrfile, timeout,
                                tmpstrucoutfile, self.map_task_to_process,
                                task_id, override_output_files, backup_log_files = backup_log_files,
                                handle = handle, log_info_on_failure=log_info_on_failure)
-        logger.info("[{0}] python_executor.run_file() returned {1}", task_id, ret)
         # Next run_file() invocations should always append to current output
         override_output_files = False
         if ret['exitcode'] != 0:
@@ -447,7 +437,6 @@
 
       # if canceled and not background command
       if handle is None:
-        logger.info("[{0}] canceled", task_id)
         cancel_reason = self.command_canceled_reason(task_id)
         if cancel_reason is not None:
           ret['stdout'] += cancel_reason
@@ -523,7 +512,6 @@
      Exit code 0 means that component is running and any other exit code means that
      component is not running
     """
-    logger.info("Requesting component status {0}".format(command_header))
     override_output_files=True # by default, we override status command output
     if logger.level == logging.DEBUG:
       override_output_files = False
@@ -531,8 +519,6 @@
     res = self.runCommand(command_header, self.status_commands_stdout,
                           self.status_commands_stderr, self.COMMAND_NAME_STATUS,
                           override_output_files=override_output_files, is_status_command=True)
-                          
-    logger.info("requestComponentStatus return={0}".format(res))
     return res
 
   def resolve_script_path(self, base_dir, script):
diff --git a/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py b/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
index bfbbc17..8b9e9ca 100644
--- a/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
+++ b/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
@@ -44,7 +44,6 @@
   used as a singleton for a concurrent execution of python scripts
   """
   NO_ERROR = "none"
-  i = 0
 
   def __init__(self, tmpDir, config):
     self.grep = Grep()
@@ -94,16 +93,14 @@
     recreated or appended.
     The structured out file, however, is preserved during multiple invocations that use the same file.
     """
-    PythonExecutor.i += 1
-    
     pythonCommand = self.python_command(script, script_params)
-    logger.info("[%d] Running command %s", PythonExecutor.i, pprint.pformat(pythonCommand))
+    if logger.isEnabledFor(logging.DEBUG):
+      logger.debug("Running command %s", pprint.pformat(pythonCommand))
 
     if handle is None:
       tmpout, tmperr = self.open_subprocess32_files(tmpoutfile, tmperrfile, override_output_files, backup_log_files)
 
       process = self.launch_python_subprocess32(pythonCommand, tmpout, tmperr)
-      logger.info("[%d] Started process with pid = %s", PythonExecutor.i, process.pid)
       # map task_id to pid
       callback(task_id, process.pid)
       logger.debug("Launching watchdog thread")
@@ -113,7 +110,6 @@
       thread.start()
       # Waiting for the process to be either finished or killed
       process.communicate()
-      logger.info("[{0}] Process communicated {1}", PythonExecutor.i, (process.returncode, tmpoutfile, tmperrfile, tmpstructedoutfile, timeout))
       self.event.set()
       thread.join()
       result = self.prepare_process_result(process.returncode, tmpoutfile, tmperrfile, tmpstructedoutfile, timeout=timeout)
@@ -121,10 +117,8 @@
       if log_info_on_failure and result['exitcode']:
         self.on_failure(pythonCommand, result)
 
-      logger.info("[{0}] PE.run_file() returned {1}", PythonExecutor.i, result)
       return result
     else:
-      logger.info("[{0}] has handle", PythonExecutor.i)
       holder = Holder(pythonCommand, tmpoutfile, tmperrfile, tmpstructedoutfile, handle)
 
       background = BackgroundThread(holder, self)
@@ -182,7 +176,6 @@
       for k, v in command_env.iteritems():
         command_env[k] = str(v)
 
-    logger.info("[{0}] launch_python_subprocess32 {1}".format(PythonExecutor.i, (command, tmpout, tmperr, close_fds, self.preexec_fn)))
     return subprocess32.Popen(command,
       stdout=tmpout,
       stderr=tmperr, close_fds=close_fds, env=command_env, preexec_fn=self.preexec_fn)