atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [1/2] incubator-atlas git commit: ATLAS-1407: improve LOG statement performance
Date Wed, 21 Dec 2016 23:48:22 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 3725dcf11 -> 40e639edd


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/main/java/org/apache/atlas/web/listeners/GuiceServletConfig.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/listeners/GuiceServletConfig.java b/webapp/src/main/java/org/apache/atlas/web/listeners/GuiceServletConfig.java
index 3bab650..d0437fc 100755
--- a/webapp/src/main/java/org/apache/atlas/web/listeners/GuiceServletConfig.java
+++ b/webapp/src/main/java/org/apache/atlas/web/listeners/GuiceServletConfig.java
@@ -102,7 +102,7 @@ public class GuiceServletConfig extends GuiceServletContextListener {
                                 String initParamValue = getServletContext().getInitParameter(initParamName);
 
                                 if (GUICE_CTX_PARAM.equals(initParamName)) {
-                                    LOG.info("Jersey loading from packages: " + initParamValue);
+                                    LOG.info("Jersey loading from packages: {}", initParamValue);
 
                                     initParams.put(PackagesResourceConfig.PROPERTY_PACKAGES,
initParamValue);
                                 } else {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
index 4a57ed2..7d65d97 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
@@ -268,10 +268,10 @@ public class EntityResource {
             LOG.error("An entity with type={} and qualifiedName={} does not exist {} ", entityType,
value, entityJson, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.NOT_FOUND));
         } catch (AtlasException | IllegalArgumentException e) {
-            LOG.error("Unable to partially update entity {} {} " + entityType + ":" + attribute
+ "." + value, entityJson, e);
+            LOG.error("Unable to partially update entity {} {}:{}.{}", entityJson, entityType,
attribute, value, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
         } catch (Throwable e) {
-            LOG.error("Unable to partially update entity {} {} " + entityType + ":" + attribute
+ "." + value, entityJson, e);
+            LOG.error("Unable to partially update entity {} {}:{}.{}", entityJson, entityType,
attribute, value, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/main/java/org/apache/atlas/web/setup/AtlasSetup.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/setup/AtlasSetup.java b/webapp/src/main/java/org/apache/atlas/web/setup/AtlasSetup.java
index 259285e..41eccd1 100644
--- a/webapp/src/main/java/org/apache/atlas/web/setup/AtlasSetup.java
+++ b/webapp/src/main/java/org/apache/atlas/web/setup/AtlasSetup.java
@@ -40,7 +40,7 @@ public class AtlasSetup {
 
     public AtlasSetup() {
         injector = Guice.createInjector(new AtlasSetupModule());
-        LOG.info("Got injector: " + injector);
+        LOG.info("Got injector: {}", injector);
     }
 
     public static void main(String[] args) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java b/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
index bc532e9..c97cc95 100644
--- a/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
+++ b/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
@@ -71,7 +71,7 @@ public class SetupSteps {
             LOG.info("Acquired lock for running setup.");
             handleSetupInProgress(configuration, zookeeperProperties);
             for (SetupStep step : setupSteps) {
-                LOG.info("Running setup step: " + step);
+                LOG.info("Running setup step: {}", step);
                 step.run();
             }
             clearSetupInProgress(zookeeperProperties);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
b/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
index 694f23e..1774611 100644
--- a/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
+++ b/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
@@ -134,7 +134,7 @@ public class EntityNotificationIT extends BaseResourceIT {
 
         Struct traitInstance = new Struct(traitName);
         String traitInstanceJSON = InstanceSerialization.toJson(traitInstance, true);
-        LOG.debug("Trait instance = " + traitInstanceJSON);
+        LOG.debug("Trait instance = {}", traitInstanceJSON);
 
         final String guid = tableId._getId();
 
@@ -161,7 +161,7 @@ public class EntityNotificationIT extends BaseResourceIT {
 
         traitInstance = new Struct(anotherTraitName);
         traitInstanceJSON = InstanceSerialization.toJson(traitInstance, true);
-        LOG.debug("Trait instance = " + traitInstanceJSON);
+        LOG.debug("Trait instance = {}", traitInstanceJSON);
 
         atlasClientV1.addTrait(guid, traitInstance);
 
@@ -200,7 +200,7 @@ public class EntityNotificationIT extends BaseResourceIT {
             TypesUtil.createTraitTypeDef(traitName, ImmutableSet.copyOf(superTraitNames));
 
         String traitDefinitionJSON = TypesSerialization$.MODULE$.toJson(trait, true);
-        LOG.debug("Trait definition = " + traitDefinitionJSON);
+        LOG.debug("Trait definition = {}", traitDefinitionJSON);
         createType(traitDefinitionJSON);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
b/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
index e15785d..23203ec 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
@@ -398,7 +398,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
         final String definition = response.getString(AtlasClient.DEFINITION);
         Assert.assertNotNull(definition);
-        LOG.debug("tableInstanceAfterGet = " + definition);
+        LOG.debug("tableInstanceAfterGet = {}", definition);
         InstanceSerialization.fromJsonReferenceable(definition, true);
     }
 
@@ -483,12 +483,12 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         HierarchicalTypeDefinition<TraitType> piiTrait =
                 TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
         String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
-        LOG.debug("traitDefinitionAsJSON = " + traitDefinitionAsJSON);
+        LOG.debug("traitDefinitionAsJSON = {}", traitDefinitionAsJSON);
         createType(traitDefinitionAsJSON);
 
         Struct traitInstance = new Struct(traitName);
         String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
-        LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
+        LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
 
         final String guid = tableId._getId();
         JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS,
traitInstanceAsJSON, guid, TRAITS);
@@ -504,12 +504,12 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         HierarchicalTypeDefinition<TraitType> piiTrait =
                 TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
         String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
-        LOG.debug("traitDefinitionAsJSON = " + traitDefinitionAsJSON);
+        LOG.debug("traitDefinitionAsJSON = {}", traitDefinitionAsJSON);
         createType(traitDefinitionAsJSON);
 
         Struct traitInstance = new Struct(traitName);
         String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
-        LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
+        LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
 
         final String guid = tableId._getId();
         JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS,
traitInstanceAsJSON, guid, TRAITS);
@@ -531,7 +531,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
         Struct traitInstance = new Struct(traitName);
         String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
-        LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
+        LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
 
         final String guid = tableId._getId();
         JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS,
traitInstanceAsJSON, guid, TRAITS);
@@ -545,13 +545,13 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
                 .createTraitTypeDef(traitName, ImmutableSet.<String>of(),
                         TypesUtil.createRequiredAttrDef("type", DataTypes.STRING_TYPE));
         String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
-        LOG.debug("traitDefinitionAsJSON = " + traitDefinitionAsJSON);
+        LOG.debug("traitDefinitionAsJSON = {}", traitDefinitionAsJSON);
         createType(traitDefinitionAsJSON);
 
         Struct traitInstance = new Struct(traitName);
         traitInstance.set("type", "SSN");
         String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
-        LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
+        LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
 
         final String guid = tableId._getId();
         JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS,
traitInstanceAsJSON, guid, TRAITS);
@@ -576,11 +576,11 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         HierarchicalTypeDefinition<TraitType> piiTrait =
                 TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
         String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
-        LOG.debug("traitDefinitionAsJSON = " + traitDefinitionAsJSON);
+        LOG.debug("traitDefinitionAsJSON = {}", traitDefinitionAsJSON);
 
         Struct traitInstance = new Struct(traitName);
         String traitInstanceAsJSON = InstanceSerialization$.MODULE$.toJson(traitInstance,
true);
-        LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
+        LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
 
         JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.CREATE_ENTITY,
traitInstanceAsJSON, "random", TRAITS);
     }
@@ -675,7 +675,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
             put("columns", columns);
         }});
 
-        LOG.debug("Updating entity= " + tableUpdated);
+        LOG.debug("Updating entity= {}", tableUpdated);
         AtlasClient.EntityResult entityResult = atlasClientV1.updateEntity(tableId._getId(),
tableUpdated);
         assertEquals(entityResult.getUpdateEntities().size(), 1);
         assertEquals(entityResult.getUpdateEntities().get(0), tableId._getId());
@@ -694,7 +694,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
             put("columns", columns);
         }});
 
-        LOG.debug("Updating entity= " + tableUpdated);
+        LOG.debug("Updating entity= {}", tableUpdated);
         entityResult = atlasClientV1.updateEntity(BaseResourceIT.HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
                 (String) tableInstance.get(QUALIFIED_NAME), tableUpdated);
         assertEquals(entityResult.getUpdateEntities().size(), 2);
@@ -740,7 +740,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         String entityJson = InstanceSerialization.toJson(tableInstance, true);
         JSONArray entityArray = new JSONArray(1);
         entityArray.put(entityJson);
-        LOG.debug("Replacing entity= " + tableInstance);
+        LOG.debug("Replacing entity= {}", tableInstance);
 
         JSONObject response = atlasClientV1.callAPIWithBody(AtlasClient.API.UPDATE_ENTITY,
entityArray);
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
b/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
index 44b7cac..c5cd3f6 100644
--- a/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
@@ -114,7 +114,7 @@ public class FileAuthenticationTest {
         when(authentication.getCredentials()).thenReturn("admin");
 
         Authentication auth = authProvider.authenticate(authentication);
-        LOG.debug(" " + auth);
+        LOG.debug(" {}", auth);
 
         Assert.assertTrue(auth.isAuthenticated());
     }
@@ -127,7 +127,7 @@ public class FileAuthenticationTest {
 
        try {
             Authentication auth = authProvider.authenticate(authentication);
-            LOG.debug(" " + auth);
+           LOG.debug(" {}", auth);
         } catch (BadCredentialsException bcExp) {
             Assert.assertEquals("Wrong password", bcExp.getMessage());
         }
@@ -140,7 +140,7 @@ public class FileAuthenticationTest {
         when(authentication.getCredentials()).thenReturn("wrongpassword");
       try {
             Authentication auth = authProvider.authenticate(authentication);
-            LOG.debug(" " + auth);
+          LOG.debug(" {}", auth);
         } catch (UsernameNotFoundException uExp) {
             Assert.assertTrue(uExp.getMessage().contains("Username not found."));
         }
@@ -153,7 +153,7 @@ public class FileAuthenticationTest {
         when(authentication.getCredentials()).thenReturn("user12");
         try {
             Authentication auth = authProvider.authenticate(authentication);
-            LOG.debug(" " + auth);
+            LOG.debug(" {}", auth);
         } catch (AtlasAuthenticationException uExp) {
             Assert.assertTrue(uExp.getMessage().startsWith("User role credentials is not
set properly for"));
         }
@@ -167,7 +167,7 @@ public class FileAuthenticationTest {
         when(authentication.getCredentials()).thenReturn("P@ssword");
         try {
             Authentication auth = authProvider.authenticate(authentication);
-            LOG.debug(" " + auth);
+            LOG.debug(" {}", auth);
         } catch (UsernameNotFoundException uExp) {
             Assert.assertTrue(uExp.getMessage().startsWith("Username not found"));
         }
@@ -180,7 +180,7 @@ public class FileAuthenticationTest {
         when(authentication.getCredentials()).thenReturn("admin");
 
         Authentication auth = authProvider.authenticate(authentication);
-        LOG.debug(" " + auth);
+        LOG.debug(" {}", auth);
 
         Assert.assertTrue(auth.isAuthenticated());
 


Mime
View raw message