PIG-5349: Log stderr output when shell command fail (knoguchi)


git-svn-id: https://svn.apache.org/repos/asf/pig/trunk@1842133 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index aa1a1a4..61f62b8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -26,6 +26,8 @@
  
 IMPROVEMENTS
 
+PIG-5349: Log stderr output when shell command fail (knoguchi)
+
 PIG-3038: Support for Credentials for UDF,Loader and Storer (satishsaley via rohini)
 
 PIG-5358: Remove hive-contrib jar from lib directory (szita)
diff --git a/src/org/apache/pig/tools/parameters/PreprocessorContext.java b/src/org/apache/pig/tools/parameters/PreprocessorContext.java
index 958c0e1..2d61a3c 100644
--- a/src/org/apache/pig/tools/parameters/PreprocessorContext.java
+++ b/src/org/apache/pig/tools/parameters/PreprocessorContext.java
@@ -274,6 +274,7 @@
         } catch (InterruptedException e) {
             throw new RuntimeException("InterruptedException while executing shell command : " + e.getMessage() , e);
         } catch (ExecutionException e) {
+            log.warn("Stderr output from command: \"" + cmd + "\" was - " + streamError);
             throw new RuntimeException("ExecutionException while executing shell command : " + e.getMessage(), e);
         } finally {
             executorService.shutdownNow();
@@ -288,6 +289,7 @@
         }
 
         if (exitVal != 0) {
+            log.warn("Stderr output from command: \"" + cmd + "\" was - " + streamError);
             RuntimeException rte = new RuntimeException("Error executing shell command: " + cmd + ". Command exit with exit code of " + exitVal );
             throw rte;
         }