You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by pa...@apache.org on 2016/06/27 11:31:38 UTC

ambari git commit: AMBARI-17214 : added logs at various places in views (Nitiraj Rathore via pallavkul)

Repository: ambari
Updated Branches:
  refs/heads/trunk 85c552686 -> b259c42df


AMBARI-17214 : added logs at various places in views (Nitiraj Rathore via pallavkul)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b259c42d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b259c42d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b259c42d

Branch: refs/heads/trunk
Commit: b259c42df8c7ad79ce55f2937238c06c7c962576
Parents: 85c5526
Author: Pallav Kulshreshtha <pa...@gmail.com>
Authored: Mon Jun 27 16:59:39 2016 +0530
Committer: Pallav Kulshreshtha <pa...@gmail.com>
Committed: Mon Jun 27 17:01:24 2016 +0530

----------------------------------------------------------------------
 .../capacityscheduler/ConfigurationService.java | 47 +++++++++++++++--
 .../view/filebrowser/DownloadService.java       | 54 +++++++++++++-------
 .../view/filebrowser/FilePreviewService.java    | 10 +++-
 .../view/filebrowser/PropertyValidator.java     |  4 ++
 .../backgroundjobs/BackgroundJobController.java |  6 +++
 .../view/hive/client/UserLocalConnection.java   |  2 +-
 .../ambari/view/pig/PropertyValidator.java      |  7 +++
 .../view/pig/resources/files/FileService.java   | 44 ++++++++++++----
 .../view/pig/resources/jobs/JobService.java     | 53 +++++++++++++++++--
 .../view/pig/resources/jobs/models/PigJob.java  | 14 ++++-
 .../pig/resources/scripts/ScriptService.java    | 35 +++++++++++--
 .../view/pig/templeton/client/JSONRequest.java  | 20 ++++----
 .../view/pig/templeton/client/TempletonApi.java |  3 +-
 13 files changed, 244 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/capacity-scheduler/src/main/java/org/apache/ambari/view/capacityscheduler/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/contrib/views/capacity-scheduler/src/main/java/org/apache/ambari/view/capacityscheduler/ConfigurationService.java b/contrib/views/capacity-scheduler/src/main/java/org/apache/ambari/view/capacityscheduler/ConfigurationService.java
index 2198331..03520fe 100644
--- a/contrib/views/capacity-scheduler/src/main/java/org/apache/ambari/view/capacityscheduler/ConfigurationService.java
+++ b/contrib/views/capacity-scheduler/src/main/java/org/apache/ambari/view/capacityscheduler/ConfigurationService.java
@@ -20,7 +20,6 @@ package org.apache.ambari.view.capacityscheduler;
 
 import org.apache.ambari.view.AmbariHttpException;
 import org.apache.ambari.view.ViewContext;
-import org.apache.ambari.view.capacityscheduler.utils.MisconfigurationFormattedException;
 import org.apache.ambari.view.capacityscheduler.utils.ServiceFormattedException;
 import org.apache.ambari.view.utils.ambari.AmbariApi;
 import org.apache.commons.io.IOUtils;
@@ -30,7 +29,14 @@ import org.json.simple.JSONValue;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.ws.rs.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import java.io.InputStream;
@@ -117,14 +123,17 @@ public class ConfigurationService {
   @GET
   @Produces(MediaType.APPLICATION_JSON)
   public Response readLatestConfiguration() {
+    LOG.debug("reading all configurations");
     Response response = null;
     try {
       String versionTag = getVersionTag();
       JSONObject configurations = getConfigurationFromAmbari(versionTag);
       response = Response.ok(configurations).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Error occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
 
@@ -140,19 +149,23 @@ public class ConfigurationService {
   @Path("cluster")
   @Produces(MediaType.APPLICATION_JSON)
   public Response readClusterInfo() {
+    LOG.debug("Reading cluster info.");
     Response response = null;
     try {
       JSONObject configurations = readFromCluster("");
       response = Response.ok(configurations).build();
     } catch (AmbariHttpException ex) {
+      LOG.error("Error occurred : ", ex);
       if (ex.getResponseCode() == 403) {
         throw new ServiceFormattedException("You do not have permission to view Capacity Scheduler configuration. Contact your Cluster administrator", ex);
       } else {
         throw new ServiceFormattedException(ex.getMessage(), ex);
       }
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Error occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
 
@@ -168,13 +181,16 @@ public class ConfigurationService {
   @Path("all")
   @Produces(MediaType.APPLICATION_JSON)
   public Response readAllConfigurations() {
+    LOG.debug("Reading all configurations.");
     Response response = null;
     try {
       JSONObject responseJSON = readFromCluster(CONFIGURATION_URL);
       response = Response.ok( responseJSON ).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Error occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
 
@@ -190,13 +206,16 @@ public class ConfigurationService {
   @Path("byTag/{tag}")
   @Produces(MediaType.APPLICATION_JSON)
   public Response readConfigurationByTag(@PathParam("tag") String tag) {
+    LOG.info("Reading configurations for tag : {}", tag);
     Response response = null;
     try {
       JSONObject configurations = getConfigurationFromAmbari(tag);
       response = Response.ok(configurations).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
 
@@ -212,6 +231,7 @@ public class ConfigurationService {
   @Produces(MediaType.APPLICATION_JSON)
   @Path("/privilege")
   public Response getPrivilege() {
+    LOG.debug("Reading privilege.");
     Response response = null;
 
     try {
@@ -219,8 +239,10 @@ public class ConfigurationService {
 
       response = Response.ok(operator).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
 
@@ -236,6 +258,7 @@ public class ConfigurationService {
   @Produces(MediaType.APPLICATION_JSON)
   @Path("/nodeLabels")
   public Response getNodeLabels() {
+    LOG.debug("reading nodeLables");
     Response response;
 
     try {
@@ -247,10 +270,13 @@ public class ConfigurationService {
 
       response = Response.ok(nodeLabels).build();
     } catch (ConnectException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException("Connection to Resource Manager refused", ex);
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
 
@@ -279,7 +305,7 @@ public class ConfigurationService {
       }
 
     } catch (AmbariHttpException e) {
-      LOG.info("Got Error response from url : {}. Response : {}", url, e.getMessage());
+      LOG.error("Got Error response from url : {}. Response : {}", url, e.getMessage(), e);
     }
 
     return false;
@@ -367,10 +393,12 @@ public class ConfigurationService {
   @Consumes(MediaType.APPLICATION_JSON)
   @Produces(MediaType.APPLICATION_JSON)
   public Response writeConfiguration(JSONObject request) {
+    LOG.debug("writeConfiguration for request : {} ", request);
     JSONObject response;
     try {
 
       if (isOperator() == false) {
+        LOG.error("returning 401 as not an operator.");
         return Response.status(401).build();
       }
 
@@ -380,8 +408,10 @@ public class ConfigurationService {
       response = getJsonObject(responseString);
 
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
 
@@ -398,9 +428,11 @@ public class ConfigurationService {
   @Produces(MediaType.APPLICATION_JSON)
   @Path("/saveAndRefresh")
   public Response writeAndRefreshConfiguration(JSONObject request) {
+    LOG.debug("writeAndRefreshConfiguration for request : {} ", request);
     try {
 
       if (isOperator() == false) {
+        LOG.error("throwing 401 error as not an operator");
         return Response.status(401).build();
       }
 
@@ -412,8 +444,10 @@ public class ConfigurationService {
       ambariApi.requestClusterAPI("requests/", "POST", data.toJSONString(), headers);
 
     } catch (WebApplicationException ex) {
+      LOG.info("Exception Occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.info("Exception Occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
     return readLatestConfiguration();
@@ -429,9 +463,11 @@ public class ConfigurationService {
   @Produces(MediaType.APPLICATION_JSON)
   @Path("/saveAndRestart")
   public Response writeAndRestartConfiguration(JSONObject request) {
+    LOG.debug("writeAndRestartConfiguration for request : {} ", request);
     try {
 
       if (isOperator() == false) {
+        LOG.error("throwing 401 error as not an operator.");
         return Response.status(401).build();
       }
 
@@ -444,8 +480,10 @@ public class ConfigurationService {
       ambariApi.requestClusterAPI("requests/", "POST", data.toJSONString(), headers);
 
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occured : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Exception occured : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
     return readLatestConfiguration();
@@ -460,6 +498,7 @@ public class ConfigurationService {
   @Produces(MediaType.APPLICATION_JSON)
   @Path("/getConfig")
   public Response getConfigurationValue(@QueryParam("siteName") String siteName,@QueryParam("configName") String configName){
+    LOG.info("Get configuration value for siteName {}, configName {}", siteName, configName);
     try{
       String configValue = context.getCluster().getConfigurationValue(siteName,configName);
       JSONObject res = new JSONObject();
@@ -472,8 +511,10 @@ public class ConfigurationService {
       res.put("configs" ,arr);
       return Response.ok(res).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java b/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java
index 4b8a546..96d3541 100644
--- a/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java
+++ b/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.net.FileNameMap;
 import java.net.URLConnection;
+import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.Queue;
 import java.util.UUID;
@@ -59,12 +60,16 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.ambari.view.ViewContext;
 import org.apache.hadoop.security.AccessControlException;
 import org.json.simple.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Service for download and aggregate files
  */
 public class DownloadService extends HdfsService {
 
+  protected static final Logger LOG = LoggerFactory.getLogger(DownloadService.class);
+
   public DownloadService(ViewContext context) {
     super(context);
   }
@@ -85,6 +90,7 @@ public class DownloadService extends HdfsService {
   public Response browse(@QueryParam("path") String path, @QueryParam("download") boolean download,
                          @QueryParam("checkperm") boolean checkperm,
                          @Context HttpHeaders headers, @Context UriInfo ui) {
+    LOG.debug("browsing path : {} with download : {}", path, download);
     try {
       HdfsApi api = getApi(context);
       FileStatus status = api.getFileStatus(path);
@@ -108,10 +114,13 @@ public class DownloadService extends HdfsService {
       }
       return result.build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception while browsing : {}", path ,ex);
       throw ex;
     } catch (FileNotFoundException ex) {
+      LOG.error("File not found while browsing : {}", path ,ex);
       throw new NotFoundFormattedException(ex.getMessage(), ex);
     } catch (Exception ex) {
+      LOG.error("Exception while browsing : {}", path ,ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -128,18 +137,14 @@ public class DownloadService extends HdfsService {
         readLen = in.read(chunk);
       }
     } catch (IOException ex) {
-      logger.error("Error zipping file " + path.substring(1) + " (file ignored): "
-          + ex.getMessage());
+      LOG.error("Error zipping file {}  (file ignored): ", path, ex);
     } catch (InterruptedException ex) {
-      String msg = "Error zipping file " + path.substring(1) + " (file ignored): "
-          + ex.getMessage();
-      logger.error(msg);
+      LOG.error("Error zipping file {} (file ignored): ", path, ex);
     } finally {
       try {
         zip.closeEntry();
       } catch (IOException ex) {
-        logger.error("Error closing entry " + path.substring(1) + " (file ignored): "
-            + ex.getMessage());
+        LOG.error("Error closing entry {} (file ignored): ", path, ex);
       }
     }
   }
@@ -148,14 +153,12 @@ public class DownloadService extends HdfsService {
     try {
       zip.putNextEntry(new ZipEntry(path.substring(1) + "/"));
     } catch (IOException ex) {
-      logger.error("Error zipping directory " + path.substring(1) + "/ (directory ignored)" + ": "
-          + ex.getMessage());
+      LOG.error("Error zipping directory {} (directory ignored).", path, ex);
     } finally {
       try {
         zip.closeEntry();
       } catch (IOException ex) {
-        logger.error("Error zipping directory " + path.substring(1) + "/ (directory ignored)" + ": "
-            + ex.getMessage());
+        LOG.error("Error zipping directory {} (directory ignored).", path, ex);
       }
     }
   }
@@ -170,6 +173,7 @@ public class DownloadService extends HdfsService {
   @Consumes(MediaType.APPLICATION_JSON)
   @Produces(MediaType.APPLICATION_OCTET_STREAM)
   public Response downloadGZip(final DownloadRequest request) {
+    LOG.debug("downloadGZip requested for : {} ", request.entries );
     try {
       String name = "hdfs.zip";
       if(request.entries.length == 1 ){
@@ -194,8 +198,7 @@ public class DownloadService extends HdfsService {
                 try {
                   subdir = api.listdir(path);
                 } catch (AccessControlException ex) {
-                  logger.error("Error zipping directory " + path.substring(1) + "/ (directory ignored)" + ": "
-                      + ex.getMessage());
+                  LOG.error("Error zipping directory {}/ (directory ignored) : ", path.substring(1), ex);
                   continue;
                 }
                 for (FileStatus file : subdir) {
@@ -209,7 +212,7 @@ public class DownloadService extends HdfsService {
               }
             }
           } catch (Exception ex) {
-            logger.error("Error occurred: " + ex.getMessage());
+            LOG.error("Error occurred: " ,ex);
             throw new ServiceFormattedException(ex.getMessage(), ex);
           } finally {
             zip.close();
@@ -219,8 +222,10 @@ public class DownloadService extends HdfsService {
       return Response.ok(result)
           .header("Content-Disposition", "inline; filename=\"" + name +"\"").build();
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred : ",ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Error occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -235,6 +240,7 @@ public class DownloadService extends HdfsService {
   @Consumes(MediaType.APPLICATION_JSON)
   @Produces(MediaType.APPLICATION_OCTET_STREAM)
   public Response concat(final DownloadRequest request) {
+    LOG.info("Starting concat files.");
     try {
       StreamingOutput result = new StreamingOutput() {
         public void write(OutputStream output) throws IOException,
@@ -245,14 +251,16 @@ public class DownloadService extends HdfsService {
               try {
                 in = getApi(context).open(path);
               } catch (AccessControlException ex) {
-                logger.error("Error in opening file {}. Ignoring concat of this files : {}", path.substring(1), ex.getMessage());
+                LOG.error("Error in opening file {}. Ignoring concat of this files.", path.substring(1), ex);
                 continue;
               }
               byte[] chunk = new byte[1024];
               while (in.read(chunk) != -1) {
                 output.write(chunk);
               }
+              LOG.info("concated file : {}", path);
             } catch (Exception ex) {
+              LOG.error("Error occurred : ", ex);
               throw new ServiceFormattedException(ex.getMessage(), ex);
             } finally {
               if (in != null)
@@ -269,8 +277,10 @@ public class DownloadService extends HdfsService {
       }
       return response.build();
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Error occurred ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -288,12 +298,15 @@ public class DownloadService extends HdfsService {
   @Consumes(MediaType.APPLICATION_JSON)
   @Produces("application/zip")
   public Response zipByRequestId(@QueryParam("requestId") String requestId) {
+    LOG.info("Starting zip download requestId : {}", requestId);
     try {
       DownloadRequest request = getDownloadRequest(requestId);
       return downloadGZip(request);
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Error occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -309,6 +322,7 @@ public class DownloadService extends HdfsService {
   @Consumes(MediaType.APPLICATION_JSON)
   @Produces(MediaType.APPLICATION_JSON)
   public Response zipGenerateLink(final DownloadRequest request) {
+    LOG.info("starting generate-link");
     return generateLink(request);
   }
 
@@ -322,12 +336,15 @@ public class DownloadService extends HdfsService {
   @Consumes(MediaType.APPLICATION_JSON)
   @Produces(MediaType.APPLICATION_OCTET_STREAM)
   public Response concatByRequestId(@QueryParam("requestId") String requestId) {
+    LOG.info("Starting concat for requestId : {}", requestId);
     try {
       DownloadRequest request = getDownloadRequest(requestId);
       return concat(request);
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Error occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -343,12 +360,14 @@ public class DownloadService extends HdfsService {
   @Consumes(MediaType.APPLICATION_JSON)
   @Produces(MediaType.APPLICATION_JSON)
   public Response concatGenerateLink(final DownloadRequest request) {
+    LOG.info("Starting link generation for concat");
     return generateLink(request);
   }
 
   private Response generateLink(DownloadRequest request) {
     try {
       String requestId = generateUniqueIdentifer(request);
+      LOG.info("returning generated requestId : {}", requestId);
       JSONObject json = new JSONObject();
       json.put("requestId", requestId);
       return Response.ok(json).build();
@@ -382,7 +401,7 @@ public class DownloadService extends HdfsService {
     try {
       HdfsUtil.putStringToFile(getApi(context), fileName, json);
     } catch (HdfsApiException e) {
-      logger.error("Failed to write request data to HDFS", e);
+      LOG.error("Failed to write request data to HDFS", e);
       throw new ServiceFormattedException("Failed to write request data to HDFS", e);
     }
   }
@@ -390,8 +409,7 @@ public class DownloadService extends HdfsService {
   private String getFileNameForRequestData(String uuid) {
     String tmpPath = context.getProperties().get("tmp.dir");
     if (tmpPath == null) {
-      String msg = "tmp.dir is not configured!";
-      logger.error(msg);
+      LOG.error("tmp.dir is not configured!");
       throw new MisconfigurationFormattedException("tmp.dir");
     }
     return String.format(tmpPath + "/%s.json", uuid);

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/FilePreviewService.java
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/FilePreviewService.java b/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/FilePreviewService.java
index 9d0e514..051e40d 100644
--- a/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/FilePreviewService.java
+++ b/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/FilePreviewService.java
@@ -29,6 +29,8 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.io.compress.CompressionCodec;
 import org.apache.hadoop.io.compress.CompressionCodecFactory;
 import org.json.simple.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.*;
 import javax.ws.rs.core.MediaType;
@@ -40,6 +42,7 @@ import java.io.InputStream;
  * File Preview Service
  */
 public class FilePreviewService extends HdfsService {
+  protected static final Logger LOG = LoggerFactory.getLogger(FilePreviewService.class);
 
   private CompressionCodecFactory compressionCodecFactory;
 
@@ -57,8 +60,8 @@ public class FilePreviewService extends HdfsService {
   @GET
   @Path("/file")
   @Produces(MediaType.APPLICATION_JSON)
-  public Response previewFile(@QueryParam("path") String path,@QueryParam("start") int start,@QueryParam("end") int end) {
-
+  public Response previewFile(@QueryParam("path") String path, @QueryParam("start") int start, @QueryParam("end") int end) {
+    LOG.info("previewing file {}, from start {}, till end {}", path, start, end);
     try {
       HdfsApi api = getApi(context);
       FileStatus status = api.getFileStatus(path);
@@ -84,10 +87,13 @@ public class FilePreviewService extends HdfsService {
 
       return Response.ok(response).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred while previewing {} : ", path, ex);
       throw ex;
     } catch (FileNotFoundException ex) {
+      LOG.error("Error occurred while previewing {} : ", path, ex);
       throw new NotFoundFormattedException(ex.getMessage(), ex);
     } catch (Exception ex) {
+      LOG.error("Error occurred while previewing {} : ", path, ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/PropertyValidator.java
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/PropertyValidator.java b/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/PropertyValidator.java
index 2ad779c..8d10179 100644
--- a/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/PropertyValidator.java
+++ b/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/PropertyValidator.java
@@ -22,8 +22,11 @@ import org.apache.ambari.view.ViewInstanceDefinition;
 import org.apache.ambari.view.utils.ambari.ValidatorUtils;
 import org.apache.ambari.view.validation.ValidationResult;
 import org.apache.ambari.view.validation.Validator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class PropertyValidator implements Validator {
+  protected static final Logger LOG = LoggerFactory.getLogger(PropertyValidator.class);
 
   public static final String WEBHDFS_URL = "webhdfs.url";
 
@@ -38,6 +41,7 @@ public class PropertyValidator implements Validator {
       String webhdfsUrl = viewInstanceDefinition.getPropertyMap().get(WEBHDFS_URL);
       if (webhdfsUrl != null) {
         if (!ValidatorUtils.validateHdfsURL(webhdfsUrl)) {
+          LOG.error("Invalid webhdfs.url = {}", webhdfsUrl);
           return new InvalidPropertyValidationResult(false, "Must be valid URL");
         }
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/backgroundjobs/BackgroundJobController.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/backgroundjobs/BackgroundJobController.java b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/backgroundjobs/BackgroundJobController.java
index 2f5c76c..ea8d51c 100644
--- a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/backgroundjobs/BackgroundJobController.java
+++ b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/backgroundjobs/BackgroundJobController.java
@@ -19,11 +19,16 @@
 package org.apache.ambari.view.hive.backgroundjobs;
 
 import org.apache.ambari.view.ViewContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.HashMap;
 import java.util.Map;
 
 public class BackgroundJobController {
+  private final static Logger LOG =
+    LoggerFactory.getLogger(BackgroundJobController.class);
+
   private ViewContext context;
 
   protected BackgroundJobController(ViewContext context) {
@@ -39,6 +44,7 @@ public class BackgroundJobController {
 
   private Map<String, Thread> jobs = new HashMap<String, Thread>();
   public void startJob(String key, Runnable runnable) {
+    LOG.info("Starting job with key : {}", key);
     if (jobs.containsKey(key)) {
       interrupt(key);
       try {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/client/UserLocalConnection.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/client/UserLocalConnection.java b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/client/UserLocalConnection.java
index a86c84f..3e2c3cc 100644
--- a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/client/UserLocalConnection.java
+++ b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/client/UserLocalConnection.java
@@ -41,7 +41,7 @@ public class UserLocalConnection extends UserLocal<Connection> {
       authCredentialsLocal.remove(context);  // we should not store credentials in memory,
       // password is erased after connection established
       Connection connection = hiveConnectionFactory.create();
-      LOG.debug("returning connection : {} for context : {} ", connection,context);
+    LOG.debug("returning connection : {} for context : {} ", connection, context);
       return connection;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/PropertyValidator.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/PropertyValidator.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/PropertyValidator.java
index cd54690..49da02a 100644
--- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/PropertyValidator.java
+++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/PropertyValidator.java
@@ -22,8 +22,12 @@ import org.apache.ambari.view.ViewInstanceDefinition;
 import org.apache.ambari.view.utils.ambari.ValidatorUtils;
 import org.apache.ambari.view.validation.ValidationResult;
 import org.apache.ambari.view.validation.Validator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class PropertyValidator implements Validator {
+  protected final static Logger LOG =
+    LoggerFactory.getLogger(PropertyValidator.class);
 
   public static final String WEBHDFS_URL = "webhdfs.url";
   public static final String WEBHCAT_PORT = "webhcat.port";
@@ -48,6 +52,7 @@ public class PropertyValidator implements Validator {
     if (property.equals(WEBHDFS_URL)) {
       String webhdfsUrl = viewInstanceDefinition.getPropertyMap().get(WEBHDFS_URL);
       if (!ValidatorUtils.validateHdfsURL(webhdfsUrl)) {
+        LOG.error("Illegal webhdfsUrl : {}", webhdfsUrl);
         return new InvalidPropertyValidationResult(false, "Must be valid URL");
       }
     }
@@ -58,9 +63,11 @@ public class PropertyValidator implements Validator {
         try {
           int port = Integer.valueOf(webhcatPort);
           if (port < 1 || port > 65535) {
+            LOG.error("Illegal port : {} ", port);
             return new InvalidPropertyValidationResult(false, "Must be from 1 to 65535");
           }
         } catch (NumberFormatException e) {
+          LOG.error("Port not numeric. webhcatPort = {}", webhcatPort);
           return new InvalidPropertyValidationResult(false, "Must be integer");
         }
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java
index 4791103..9dea2a2 100644
--- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java
+++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java
@@ -22,7 +22,10 @@ import com.google.inject.Inject;
 import org.apache.ambari.view.ViewContext;
 import org.apache.ambari.view.ViewResourceHandler;
 import org.apache.ambari.view.pig.services.BaseService;
-import org.apache.ambari.view.pig.utils.*;
+import org.apache.ambari.view.pig.utils.BadRequestFormattedException;
+import org.apache.ambari.view.pig.utils.FilePaginator;
+import org.apache.ambari.view.pig.utils.NotFoundFormattedException;
+import org.apache.ambari.view.pig.utils.ServiceFormattedException;
 import org.apache.ambari.view.utils.hdfs.HdfsApi;
 import org.apache.ambari.view.utils.hdfs.HdfsUtil;
 import org.apache.ambari.view.commons.hdfs.UserService;
@@ -34,8 +37,20 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.LinkedList;
@@ -71,10 +86,9 @@ public class FileService extends BaseService {
                           @QueryParam("page") Long page,
                           @QueryParam("action") String action) throws IOException, InterruptedException {
     try {
-
       filePath = sanitizeFilePath(filePath);
       if (action != null && action.equals("ls")) {
-        LOG.debug("List directory " + filePath);
+        LOG.debug("List directory {}", filePath);
         List<String> ls = new LinkedList<String>();
         for (FileStatus fs : getHdfsApi().listdir(filePath)) {
           ls.add(fs.getPath().toString());
@@ -83,7 +97,7 @@ public class FileService extends BaseService {
         object.put("ls", ls);
         return Response.ok(object).status(200).build();
       }
-      LOG.debug("Reading file " + filePath);
+      LOG.debug("Reading file {}", filePath);
       FilePaginator paginator = new FilePaginator(filePath, context);
 
       if (page == null)
@@ -100,12 +114,16 @@ public class FileService extends BaseService {
       object.put("file", file);
       return Response.ok(object).status(200).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred : ", ex);
       throw ex;
     } catch (FileNotFoundException ex) {
+      LOG.error("Error occurred : ", ex);
       throw new NotFoundFormattedException(ex.getMessage(), ex);
     } catch (IllegalArgumentException ex) {
+      LOG.error("Error occurred : ", ex);
       throw new BadRequestFormattedException(ex.getMessage(), ex);
     } catch (Exception ex) {
+      LOG.error("Error occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -120,14 +138,16 @@ public class FileService extends BaseService {
 
       filePath = sanitizeFilePath(filePath);
 
-      LOG.debug("Deleting file " + filePath);
+      LOG.info("Deleting file {}", filePath);
       if (getHdfsApi().delete(filePath, false)) {
         return Response.status(204).build();
       }
       throw new NotFoundFormattedException("FileSystem.delete returned false", null);
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Error occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -142,14 +162,16 @@ public class FileService extends BaseService {
                              @PathParam("filePath") String filePath) throws IOException, InterruptedException {
     try {
       filePath = sanitizeFilePath(filePath);
-      LOG.debug("Rewriting file " + filePath);
+      LOG.info("Rewriting file {}", filePath);
       FSDataOutputStream output = getHdfsApi().create(filePath, true);
       output.writeBytes(request.file.getFileContent());
       output.close();
       return Response.status(204).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Error occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -163,7 +185,7 @@ public class FileService extends BaseService {
                              @Context HttpServletResponse response, @Context UriInfo ui)
       throws IOException, InterruptedException {
     try {
-      LOG.debug("Creating file " + request.file.getFilePath());
+      LOG.info("Creating file {}", request.file.getFilePath());
       try {
         FSDataOutputStream output = getHdfsApi().create(request.file.getFilePath(), false);
         if (request.file.getFileContent() != null) {
@@ -177,8 +199,10 @@ public class FileService extends BaseService {
           String.format("%s/%s", ui.getAbsolutePath().toString(), request.file.getFilePath()));
       return Response.status(204).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Error occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -192,8 +216,10 @@ public class FileService extends BaseService {
       HdfsApi api = HdfsUtil.connectToHDFSApi(context);
       api.getStatus();
     } catch (WebApplicationException ex) {
+      LOG.error("Error occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Error occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobService.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobService.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobService.java
index 9ecbd75..0c2ce2d 100644
--- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobService.java
+++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobService.java
@@ -19,7 +19,6 @@
 package org.apache.ambari.view.pig.resources.jobs;
 
 import com.google.inject.Inject;
-import org.apache.ambari.view.ViewContext;
 import org.apache.ambari.view.ViewResourceHandler;
 import org.apache.ambari.view.pig.persistence.utils.Indexed;
 import org.apache.ambari.view.pig.persistence.utils.ItemNotFound;
@@ -36,8 +35,20 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
 import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.Callable;
@@ -91,11 +102,13 @@ public class JobService extends BaseService {
   @Path("{jobId}")
   @Produces(MediaType.APPLICATION_JSON)
   public Response getJob(@PathParam("jobId") String jobId) {
+    LOG.info("Fetching job with id : {}", jobId);
     try {
       PigJob job = null;
       try {
         job = getResourceManager().read(jobId);
       } catch (ItemNotFound itemNotFound) {
+        LOG.error("Exception occurred : ", itemNotFound);
         throw new NotFoundFormattedException(itemNotFound.getMessage(), itemNotFound);
       }
       getResourceManager().retrieveJobStatus(job);
@@ -103,8 +116,10 @@ public class JobService extends BaseService {
       object.put("job", job);
       return Response.ok(object).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -116,11 +131,13 @@ public class JobService extends BaseService {
   @Path("{jobId}")
   public Response killJob(@PathParam("jobId") String jobId,
                           @QueryParam("remove") final String remove) throws IOException {
+    LOG.info("killing job : {}, remove : {}", jobId, remove);
     try {
       PigJob job = null;
       try {
         job = getResourceManager().read(jobId);
       } catch (ItemNotFound itemNotFound) {
+        LOG.error("Exception occurred : ", itemNotFound);
         throw new NotFoundFormattedException(itemNotFound.getMessage(), itemNotFound);
       }
       getResourceManager().killJob(job);
@@ -129,8 +146,10 @@ public class JobService extends BaseService {
       }
       return Response.status(204).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -151,6 +170,7 @@ public class JobService extends BaseService {
           try {
             job = getResourceManager().read(jobId);
           } catch (ItemNotFound itemNotFound) {
+            LOG.error("Exception occurred : ", itemNotFound);
             return null;
           }
           return job;
@@ -162,8 +182,10 @@ public class JobService extends BaseService {
       getResourceManager().retrieveJobStatus(job);
       return Response.ok().build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -176,19 +198,22 @@ public class JobService extends BaseService {
                               @PathParam("jobId") String jobId,
                               @PathParam("fileName") String fileName,
                               @QueryParam("page") Long page) {
+    LOG.info("fetching results in fileName {} ", fileName);
     try {
       PigJob job = null;
       try {
         job = getResourceManager().read(jobId);
       } catch (ItemNotFound itemNotFound) {
+        LOG.error("Exception occurred : ", itemNotFound);
         throw new NotFoundFormattedException("Job with id '" + jobId + "' not found", null);
       }
       String filePath = job.getStatusDir() + "/" + fileName;
-      LOG.debug("Reading file " + filePath);
+      LOG.debug("Reading file {}", filePath);
       FilePaginator paginator = new FilePaginator(filePath, context);
 
-      if (page == null)
+      if (page == null) {
         page = 0L;
+      }
 
       FileResource file = new FileResource();
       file.setFilePath(filePath);
@@ -201,12 +226,16 @@ public class JobService extends BaseService {
       object.put("file", file);
       return Response.ok(object).status(200).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (IOException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new NotFoundFormattedException(ex.getMessage(), ex);
     } catch (InterruptedException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new NotFoundFormattedException(ex.getMessage(), ex);
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -217,6 +246,7 @@ public class JobService extends BaseService {
   @GET
   @Produces(MediaType.APPLICATION_JSON)
   public Response getJobList(@QueryParam("scriptId") final String scriptId) {
+    LOG.info("Fechting scriptId : {} ", scriptId);
     try {
       List allJobs = getResourceManager().readAll(
           new OnlyOwnersFilteringStrategy(this.context.getUsername()) {
@@ -235,8 +265,10 @@ public class JobService extends BaseService {
       object.put("jobs", allJobs);
       return Response.ok(object).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -249,6 +281,7 @@ public class JobService extends BaseService {
   @Produces(MediaType.APPLICATION_JSON)
   public Response runJob(PigJobRequest request, @Context HttpServletResponse response,
                          @Context UriInfo ui) {
+    LOG.info("Creating new job : {} ", request);
     try {
       request.validatePOST();
       getResourceManager().create(request.job);
@@ -268,10 +301,13 @@ public class JobService extends BaseService {
       object.put("job", job);
       return Response.ok(object).status(201).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (IllegalArgumentException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new BadRequestFormattedException(ex.getMessage(), ex);
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -299,5 +335,12 @@ public class JobService extends BaseService {
         throw new BadRequestFormattedException(explainPOST(), null);
       }
     }
+
+    @Override
+    public String toString() {
+      return new StringBuilder("PigJobRequest{")
+        .append("job=").append(job)
+        .append('}').toString();
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/models/PigJob.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/models/PigJob.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/models/PigJob.java
index 6f80d6b..2aa0cf0 100644
--- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/models/PigJob.java
+++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/models/PigJob.java
@@ -102,9 +102,8 @@ public class PigJob implements Serializable, PersonalResource {
 
     PigJob pigScript = (PigJob) o;
 
-    if (!id.equals(pigScript.id)) return false;
+    return id.equals(pigScript.id);
 
-    return true;
   }
 
   @Override
@@ -256,4 +255,15 @@ public class PigJob implements Serializable, PersonalResource {
   public void setSourceFile(String sourceFile) {
     this.sourceFile = sourceFile;
   }
+
+  @Override
+  public String toString() {
+    return new StringBuilder("PigJob{")
+      .append("id='").append(id)
+      .append(", scriptId='").append(scriptId)
+      .append(", owner='").append(owner)
+      .append(", jobId='").append(jobId)
+      .append('}')
+      .toString();
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/scripts/ScriptService.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/scripts/ScriptService.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/scripts/ScriptService.java
index 46e6247..3e29c41 100644
--- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/scripts/ScriptService.java
+++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/scripts/ScriptService.java
@@ -20,8 +20,8 @@ package org.apache.ambari.view.pig.resources.scripts;
 
 import com.google.inject.Inject;
 import org.apache.ambari.view.ViewResourceHandler;
-import org.apache.ambari.view.pig.persistence.utils.OnlyOwnersFilteringStrategy;
 import org.apache.ambari.view.pig.persistence.utils.ItemNotFound;
+import org.apache.ambari.view.pig.persistence.utils.OnlyOwnersFilteringStrategy;
 import org.apache.ambari.view.pig.resources.PersonalCRUDResourceManager;
 import org.apache.ambari.view.pig.resources.scripts.models.PigScript;
 import org.apache.ambari.view.pig.services.BaseService;
@@ -32,8 +32,19 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
 import java.util.List;
 
 /**
@@ -69,6 +80,7 @@ public class ScriptService extends BaseService {
   @Path("{scriptId}")
   @Produces(MediaType.APPLICATION_JSON)
   public Response getScript(@PathParam("scriptId") String scriptId) {
+    LOG.info("Fetching scriptId : {}", scriptId);
     try {
       PigScript script = null;
       script = getResourceManager().read(scriptId);
@@ -76,10 +88,13 @@ public class ScriptService extends BaseService {
       object.put("script", script);
       return Response.ok(object).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (ItemNotFound itemNotFound) {
+      LOG.error("Exception occurred : ", itemNotFound);
       throw new NotFoundFormattedException(itemNotFound.getMessage(), itemNotFound);
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -90,14 +105,18 @@ public class ScriptService extends BaseService {
   @DELETE
   @Path("{scriptId}")
   public Response deleteScript(@PathParam("scriptId") String scriptId) {
+    LOG.info("Deleting scriptId : {}", scriptId);
     try {
       getResourceManager().delete(scriptId);
       return Response.status(204).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (ItemNotFound itemNotFound) {
+      LOG.error("Exception occurred : ", itemNotFound);
       throw new NotFoundFormattedException(itemNotFound.getMessage(), itemNotFound);
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -117,8 +136,10 @@ public class ScriptService extends BaseService {
       object.put("scripts", allScripts);
       return Response.ok(object).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -131,14 +152,18 @@ public class ScriptService extends BaseService {
   @Consumes(MediaType.APPLICATION_JSON)
   public Response updateScript(PigScriptRequest request,
                                @PathParam("scriptId") String scriptId) {
+    LOG.info("updating scriptId : {} ", scriptId);
     try {
       getResourceManager().update(request.script, scriptId);
       return Response.status(204).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (ItemNotFound itemNotFound) {
+      LOG.error("Exception occurred : ", itemNotFound);
       throw new NotFoundFormattedException(itemNotFound.getMessage(), itemNotFound);
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }
@@ -150,6 +175,7 @@ public class ScriptService extends BaseService {
   @Consumes(MediaType.APPLICATION_JSON)
   public Response saveScript(PigScriptRequest request, @Context HttpServletResponse response,
                              @Context UriInfo ui) {
+    LOG.info("Creating new script : {}", request);
     try {
       getResourceManager().create(request.script);
 
@@ -164,10 +190,13 @@ public class ScriptService extends BaseService {
       object.put("script", script);
       return Response.ok(object).status(201).build();
     } catch (WebApplicationException ex) {
+      LOG.error("Exception occurred : ", ex);
       throw ex;
     } catch (ItemNotFound itemNotFound) {
+      LOG.error("Exception occurred : ", itemNotFound);
       throw new NotFoundFormattedException(itemNotFound.getMessage(), itemNotFound);
     } catch (Exception ex) {
+      LOG.error("Exception occurred : ", ex);
       throw new ServiceFormattedException(ex.getMessage(), ex);
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/templeton/client/JSONRequest.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/templeton/client/JSONRequest.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/templeton/client/JSONRequest.java
index 923c057..92fb18e 100644
--- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/templeton/client/JSONRequest.java
+++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/templeton/client/JSONRequest.java
@@ -74,13 +74,13 @@ public class JSONRequest<RESPONSE> {
    * @return unmarshalled response data
    */
   public RESPONSE get(WebResource resource) throws IOException {
-    LOG.debug("GET " + resource.toString());
+    LOG.info("GET {}", resource);
 
     InputStream inputStream = readFrom(resource, "GET", null, new HashMap<String, String>());
 
     recordLastCurlCommand(String.format("curl \"" + resource.toString() + "\""));
     String responseJson = IOUtils.toString(inputStream);
-    LOG.debug(String.format("RESPONSE => %s", responseJson));
+    LOG.debug("RESPONSE {}", responseJson);
     return gson.fromJson(responseJson, responseClass);
   }
 
@@ -107,8 +107,8 @@ public class JSONRequest<RESPONSE> {
    * @return unmarshalled response data
    */
   public RESPONSE post(WebResource resource, MultivaluedMapImpl data) throws IOException {
-    LOG.debug("POST " + resource.toString());
-    LOG.debug("data: " + data.toString());
+    LOG.info("POST: {}", resource);
+    LOG.debug("data: {}", data);
 
     StringBuilder curlBuilder = new StringBuilder();
 
@@ -121,7 +121,7 @@ public class JSONRequest<RESPONSE> {
     InputStream inputStream = readFrom(resource, "POST", builder.build().getRawQuery(), headers);
     String responseJson = IOUtils.toString(inputStream);
 
-    LOG.debug(String.format("RESPONSE => %s", responseJson));
+    LOG.debug("RESPONSE => {}", responseJson);
     return gson.fromJson(responseJson, responseClass);
   }
 
@@ -153,7 +153,7 @@ public class JSONRequest<RESPONSE> {
    * @return unmarshalled response data
    */
   public RESPONSE put(WebResource resource, MultivaluedMapImpl data) throws IOException {
-    LOG.debug("PUT " + resource.toString());
+    LOG.info("PUT {}", resource);
 
     StringBuilder curlBuilder = new StringBuilder();
 
@@ -167,7 +167,7 @@ public class JSONRequest<RESPONSE> {
     InputStream inputStream = readFrom(resource, "PUT", builder.build().getRawQuery(), headers);
     String responseJson = IOUtils.toString(inputStream);
 
-    LOG.debug(String.format("RESPONSE => %s", responseJson));
+    LOG.debug("RESPONSE => {}", responseJson);
     return gson.fromJson(responseJson, responseClass);
   }
 
@@ -190,7 +190,7 @@ public class JSONRequest<RESPONSE> {
     }
 
     if (data != null)
-      LOG.debug("... data: " + builder.build().getRawQuery());
+      LOG.debug("data: {}", builder.build().getRawQuery());
     return builder;
   }
 
@@ -222,7 +222,7 @@ public class JSONRequest<RESPONSE> {
    * @return unmarshalled response data
    */
   public RESPONSE delete(WebResource resource, MultivaluedMapImpl data) throws IOException {
-    LOG.debug("DELETE " + resource.toString());
+    LOG.info("DELETE {}", resource.toString());
 
     StringBuilder curlBuilder = new StringBuilder();
 
@@ -236,7 +236,7 @@ public class JSONRequest<RESPONSE> {
     InputStream inputStream = readFrom(resource, "DELETE", builder.build().getRawQuery(), headers);
     String responseJson = IOUtils.toString(inputStream);
 
-    LOG.debug(String.format("RESPONSE => %s", responseJson));
+    LOG.debug("RESPONSE => {}", responseJson);
     return gson.fromJson(responseJson, responseClass);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b259c42d/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/templeton/client/TempletonApi.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/templeton/client/TempletonApi.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/templeton/client/TempletonApi.java
index 66568d7..d855474 100644
--- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/templeton/client/TempletonApi.java
+++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/templeton/client/TempletonApi.java
@@ -142,8 +142,7 @@ public class TempletonApi {
     try {
       request.delete();
     } catch (IOException e) {
-      //TODO: remove this after HIVE-5835 resolved
-      LOG.debug("Ignoring 500 response from webhcat (see HIVE-5835)");
+      LOG.error("Ignoring 500 response from webhcat (see HIVE-5835)");
     }
   }