ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From magyari_san...@apache.org
Subject ambari git commit: AMBARI-16118. Additional logs required when posting ambari configuration failed with 400 response. (magyari_sandor)
Date Wed, 27 Apr 2016 14:15:31 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 f982e420d -> e9ef632db


AMBARI-16118. Additional logs required when posting ambari configuration failed with 400 response.
(magyari_sandor)


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

Branch: refs/heads/branch-2.2
Commit: e9ef632db8f72b85cdb060b02fd1ef7022671be5
Parents: f982e42
Author: Sandor Magyari <smagyari@hortonworks.com>
Authored: Tue Apr 26 19:01:34 2016 +0200
Committer: Sandor Magyari <smagyari@hortonworks.com>
Committed: Wed Apr 27 15:58:20 2016 +0200

----------------------------------------------------------------------
 .../apache/ambari/server/api/handlers/CreateHandler.java  |  2 ++
 .../apache/ambari/server/api/services/BaseService.java    | 10 ++++++++++
 .../controller/internal/ClusterResourceProvider.java      |  1 -
 3 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e9ef632d/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/CreateHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/CreateHandler.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/CreateHandler.java
index 706d2be..79f1b25 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/CreateHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/CreateHandler.java
@@ -49,6 +49,7 @@ public class CreateHandler extends BaseManagementHandler {
 
     } catch (UnsupportedPropertyException e) {
       result = new ResultImpl(new ResultStatus(ResultStatus.STATUS.BAD_REQUEST, e.getMessage()));
+      LOG.error("Bad request received: " + e.getMessage());
     } catch (NoSuchParentResourceException e) {
       //todo: is this the correct status code?
       result = new ResultImpl(new ResultStatus(ResultStatus.STATUS.NOT_FOUND, e.getMessage()));
@@ -60,6 +61,7 @@ public class CreateHandler extends BaseManagementHandler {
     } catch (ResourceAlreadyExistsException e) {
       result = new ResultImpl(new ResultStatus(ResultStatus.STATUS.CONFLICT, e.getMessage()));
     } catch(IllegalArgumentException e) {
+      LOG.error("Bad request received: " + e.getMessage());
       result = new ResultImpl(new ResultStatus(ResultStatus.STATUS.BAD_REQUEST, e.getMessage()));
     } catch (RuntimeException e) {
       if (LOG.isErrorEnabled()) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/e9ef632d/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
index 7945599..3ab21fd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
@@ -30,6 +30,8 @@ import org.apache.ambari.server.api.services.serializers.ResultSerializer;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.utils.RetryHelper;
 import org.eclipse.jetty.util.ajax.JSON;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
@@ -46,6 +48,11 @@ public abstract class BaseService {
   public final static MediaType MEDIA_TYPE_TEXT_CSV_TYPE = new MediaType("text", "csv");
 
   /**
+   * Logger instance.
+   */
+  protected final static Logger LOG = LoggerFactory.getLogger(BaseService.class);
+
+  /**
    * Factory for creating resource instances.
    */
   private ResourceInstanceFactory m_resourceFactory = new ResourceInstanceFactoryImpl();
@@ -107,6 +114,9 @@ public abstract class BaseService {
       }
     } catch (BodyParseException e) {
       result =  new ResultImpl(new ResultStatus(ResultStatus.STATUS.BAD_REQUEST, e.getMessage()));
+      LOG.error("Bad request received: " + e.getMessage());
+    } catch (Throwable t) {
+      throw t;
     }
 
     ResultSerializer serializer = mediaType == null ? getResultSerializer() : getResultSerializer(mediaType);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e9ef632d/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
index 82b9d9f..2e9618d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
@@ -518,7 +518,6 @@ public class ClusterResourceProvider extends AbstractControllerResourceProvider
     } catch (InvalidTopologyException e) {
       throw new IllegalArgumentException("Topology validation failed: " + e, e);
     } catch (AmbariException e) {
-      e.printStackTrace();
       throw new SystemException("Unknown exception when asking TopologyManager to provision
cluster", e);
     }
   }


Mime
View raw message