atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-atlas git commit: ATLAS-1471: logging update (3) to reduce excessive info level logs, reduce overheads, switch to sl4j logger
Date Sun, 29 Jan 2017 18:17:02 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 4b8b9e22f -> f83e8ee86


ATLAS-1471: logging update (3) to reduce excessive info level logs, reduce overheads, switch
to sl4j logger


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

Branch: refs/heads/master
Commit: f83e8ee863d1657be652130024f3e7c99a2482f1
Parents: 4b8b9e2
Author: Madhan Neethiraj <madhan@apache.org>
Authored: Sun Jan 29 01:55:54 2017 -0800
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Sun Jan 29 01:55:54 2017 -0800

----------------------------------------------------------------------
 .../authorize/simple/AtlasAuthorizationUtils.java   |  8 ++++++--
 .../atlas/authorize/simple/FileReaderUtil.java      | 10 +++++-----
 .../apache/atlas/authorize/simple/PolicyUtil.java   | 10 ++++++++--
 .../java/org/apache/atlas/utils/PropertiesUtil.java |  5 +++--
 .../org/apache/atlas/utils/XMLPropertiesUtil.java   |  5 +++--
 .../apache/atlas/GraphTransactionInterceptor.java   |  6 +++++-
 .../repository/audit/HBaseBasedAuditRepository.java | 16 +++++++++++++---
 .../web/filters/AtlasCSRFPreventionFilter.java      |  5 +++--
 .../web/security/AtlasADAuthenticationProvider.java |  6 +++---
 .../security/AtlasAuthenticationFailureHandler.java |  5 +++--
 .../security/AtlasAuthenticationSuccessHandler.java |  5 +++--
 .../security/AtlasFileAuthenticationProvider.java   |  5 +++--
 .../security/AtlasLdapAuthenticationProvider.java   |  6 +++---
 13 files changed, 61 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java
b/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java
index f30dfe0..1b4661e 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java
@@ -40,7 +40,7 @@ public class AtlasAuthorizationUtils {
 
     public static String getApi(String contextPath) {
         if (isDebugEnabled) {
-            LOG.debug("==> getApi from {}", contextPath);
+            LOG.debug("==> getApi({})", contextPath);
         }
         if (contextPath.startsWith(BASE_URL)) {
             contextPath = contextPath.substring(BASE_URL.length());
@@ -56,7 +56,11 @@ public class AtlasAuthorizationUtils {
         if(Pattern.matches("v\\d", api)) {
             api = split[1];
         }
-        LOG.info("Now returning API : "+api);
+
+        if (isDebugEnabled) {
+            LOG.debug("<== getApi({}): {}", contextPath, api);
+        }
+
         return api;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/authorization/src/main/java/org/apache/atlas/authorize/simple/FileReaderUtil.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/FileReaderUtil.java
b/authorization/src/main/java/org/apache/atlas/authorize/simple/FileReaderUtil.java
index 9d9caa9..36db700 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/simple/FileReaderUtil.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/FileReaderUtil.java
@@ -26,18 +26,18 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Pattern;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class FileReaderUtil {
-    private static Logger LOG = Logger.getLogger(FileReaderUtil.class);
+    private static Logger LOG = LoggerFactory.getLogger(FileReaderUtil.class);
     private static boolean isDebugEnabled = LOG.isDebugEnabled();
 
     public static List<String> readFile(String path) throws IOException {
         if (isDebugEnabled) {
-            LOG.debug("==> FileReaderUtil readFile");
+            LOG.debug("==> FileReaderUtil readFile({})", path);
         }
         List<String> list = new ArrayList<>();
-        LOG.info("reading the file" + path);
         List<String> fileLines = Files.readAllLines(Paths.get(path), Charset.forName("UTF-8"));
         if (fileLines != null) {
             for (String line : fileLines) {
@@ -47,7 +47,7 @@ public class FileReaderUtil {
         }
 
         if (isDebugEnabled) {
-            LOG.debug("<== FileReaderUtil readFile");
+            LOG.debug("<== FileReaderUtil readFile({})", path);
             LOG.debug("Policies read :: " + list);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java
b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java
index 0465c48..4f9255a 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java
@@ -43,7 +43,10 @@ public class PolicyUtil {
 
         // Iterate over the list of policies to create map
         for (PolicyDef policyDef : policyDefList) {
-            LOG.info("Processing policy def : {}", policyDef);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Processing policy def : {}", policyDef);
+            }
+
             Map<String, List<AtlasActionTypes>> principalMap =
                 principalType.equals(SimpleAtlasAuthorizer.AtlasAccessorTypes.USER) ? policyDef.getUsers()
: policyDef
                     .getGroups();
@@ -88,7 +91,10 @@ public class PolicyUtil {
                     userResourceList.put(type, resourceList);
                 }
                 userReadMap.put(username, userResourceList);
-                LOG.info("userReadMap {}", userReadMap);
+
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("userReadMap {}", userReadMap);
+                }
             }
         }
         if (isDebugEnabled) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/common/src/main/java/org/apache/atlas/utils/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/utils/PropertiesUtil.java b/common/src/main/java/org/apache/atlas/utils/PropertiesUtil.java
index d5cf15c..e7c4b94 100644
--- a/common/src/main/java/org/apache/atlas/utils/PropertiesUtil.java
+++ b/common/src/main/java/org/apache/atlas/utils/PropertiesUtil.java
@@ -24,7 +24,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
 
@@ -33,7 +34,7 @@ import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
  */
 public final class PropertiesUtil extends PropertyPlaceholderConfigurer {
     private static Map<String, String> propertiesMap = new HashMap<>();
-    private static Logger logger = Logger.getLogger(PropertiesUtil.class);
+    private static Logger logger = LoggerFactory.getLogger(PropertiesUtil.class);
     protected List<String> xmlPropertyConfigurer = new ArrayList<>();
 
     private PropertiesUtil() {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/common/src/main/java/org/apache/atlas/utils/XMLPropertiesUtil.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/utils/XMLPropertiesUtil.java b/common/src/main/java/org/apache/atlas/utils/XMLPropertiesUtil.java
index fee5371..271c1c6 100644
--- a/common/src/main/java/org/apache/atlas/utils/XMLPropertiesUtil.java
+++ b/common/src/main/java/org/apache/atlas/utils/XMLPropertiesUtil.java
@@ -25,7 +25,8 @@ import java.util.Properties;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.util.DefaultPropertiesPersister;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -35,7 +36,7 @@ import org.w3c.dom.NodeList;
  * Util class for XMLProperties.
  */
 public class XMLPropertiesUtil extends DefaultPropertiesPersister {
-    private static Logger logger = Logger.getLogger(XMLPropertiesUtil.class);
+    private static Logger logger = LoggerFactory.getLogger(XMLPropertiesUtil.class);
 
     public XMLPropertiesUtil() {
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java b/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
index a798f34..0f85b61 100644
--- a/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
+++ b/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
@@ -51,7 +51,11 @@ public class GraphTransactionInterceptor implements MethodInterceptor {
                 Object response = invocation.proceed();
                 graph.commit();
                 isSuccess = true;
-                LOG.info("graph commit");
+
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("graph commit");
+                }
+
                 return response;
             } catch (Throwable t) {
                 if (logException(t)) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
b/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
index fb05e5a..9de2110 100644
--- a/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
@@ -121,7 +121,10 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
      * @throws AtlasException
      */
     public void putEvents(List<EntityAuditEvent> events) throws AtlasException {
-        LOG.info("Putting {} events", events.size());
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Putting {} events", events.size());
+        }
+
         Table table = null;
         try {
             table = connection.getTable(tableName);
@@ -168,7 +171,10 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
      */
     public List<EntityAuditEvent> listEvents(String entityId, String startKey, short
n)
             throws AtlasException {
-        LOG.info("Listing events for entity id {}, starting timestamp {}, #records {}", entityId,
startKey, n);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Listing events for entity id {}, starting timestamp {}, #records {}",
entityId, startKey, n);
+        }
+
         Table table = null;
         ResultScanner scanner = null;
         try {
@@ -216,7 +222,11 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
                 }
                 events.add(event);
             }
-            LOG.info("Got events for entity id {}, starting timestamp {}, #records {}", entityId,
startKey, events.size());
+
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Got events for entity id {}, starting timestamp {}, #records {}",
entityId, startKey, events.size());
+            }
+
             return events;
         } catch (IOException e) {
             throw new AtlasException(e);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
index 596b3f7..5294c9b 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
@@ -34,7 +34,8 @@ import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
 import org.apache.commons.configuration.Configuration;
@@ -42,7 +43,7 @@ import org.codehaus.jackson.map.ObjectMapper;
 import org.json.simple.JSONObject;
 
 public class AtlasCSRFPreventionFilter implements Filter {
-	private static final Logger LOG = Logger.getLogger(AtlasCSRFPreventionFilter.class);
+	private static final Logger LOG = LoggerFactory.getLogger(AtlasCSRFPreventionFilter.class);
 	private static Configuration configuration;
 	
 	static {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/webapp/src/main/java/org/apache/atlas/web/security/AtlasADAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasADAuthenticationProvider.java
b/webapp/src/main/java/org/apache/atlas/web/security/AtlasADAuthenticationProvider.java
index ecbb4ef..3a6a9e1 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasADAuthenticationProvider.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasADAuthenticationProvider.java
@@ -27,7 +27,8 @@ import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.web.model.User;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationConverter;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
@@ -39,8 +40,7 @@ import org.springframework.stereotype.Component;
 @Component
 public class AtlasADAuthenticationProvider extends
         AtlasAbstractAuthenticationProvider {
-    private static Logger LOG = Logger
-            .getLogger(AtlasADAuthenticationProvider.class);
+    private static Logger LOG = LoggerFactory.getLogger(AtlasADAuthenticationProvider.class);
 
     private String adURL;
     private String adDomain;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationFailureHandler.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationFailureHandler.java
b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationFailureHandler.java
index 4f946ed..49a7e86 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationFailureHandler.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationFailureHandler.java
@@ -18,7 +18,8 @@
 
 package org.apache.atlas.web.security;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.codehaus.jackson.map.ObjectMapper;
 import org.json.simple.JSONObject;
 import org.springframework.security.core.AuthenticationException;
@@ -32,7 +33,7 @@ import java.io.IOException;
 
 public class AtlasAuthenticationFailureHandler implements AuthenticationFailureHandler {
 
-    private static Logger LOG = Logger.getLogger(AtlasAuthenticationFailureHandler.class);
+    private static Logger LOG = LoggerFactory.getLogger(AtlasAuthenticationFailureHandler.class);
 
     @Override
     public void onAuthenticationFailure(HttpServletRequest httpServletRequest, HttpServletResponse
response,

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationSuccessHandler.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationSuccessHandler.java
b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationSuccessHandler.java
index 31a9ec0..2942e8e 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationSuccessHandler.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationSuccessHandler.java
@@ -18,7 +18,8 @@
 
 package org.apache.atlas.web.security;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.codehaus.jackson.map.ObjectMapper;
 import org.json.simple.JSONObject;
 import org.springframework.security.core.Authentication;
@@ -32,7 +33,7 @@ import java.io.IOException;
 
 public class AtlasAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
 
-    private static Logger LOG = Logger.getLogger(AuthenticationSuccessHandler.class);
+    private static Logger LOG = LoggerFactory.getLogger(AuthenticationSuccessHandler.class);
     @Override
     public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
                                         Authentication authentication) throws IOException,
ServletException {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/webapp/src/main/java/org/apache/atlas/web/security/AtlasFileAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasFileAuthenticationProvider.java
b/webapp/src/main/java/org/apache/atlas/web/security/AtlasFileAuthenticationProvider.java
index 3e1e2e6..1032b1c 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasFileAuthenticationProvider.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasFileAuthenticationProvider.java
@@ -19,7 +19,8 @@ package org.apache.atlas.web.security;
 import java.util.Collection;
 
 import org.apache.atlas.web.dao.UserDao;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -34,7 +35,7 @@ import org.springframework.stereotype.Component;
 @Component
 public class AtlasFileAuthenticationProvider extends AtlasAbstractAuthenticationProvider
{
 
-    private static Logger logger = Logger.getLogger(AtlasFileAuthenticationProvider.class);
+    private static Logger logger = LoggerFactory.getLogger(AtlasFileAuthenticationProvider.class);
 
     @Autowired
     private UserDetailsService userDetailsService;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f83e8ee8/webapp/src/main/java/org/apache/atlas/web/security/AtlasLdapAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasLdapAuthenticationProvider.java
b/webapp/src/main/java/org/apache/atlas/web/security/AtlasLdapAuthenticationProvider.java
index 65ee55c..f5ef058 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasLdapAuthenticationProvider.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasLdapAuthenticationProvider.java
@@ -25,7 +25,8 @@ import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.web.model.User;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationConverter;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.ldap.core.support.LdapContextSource;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
@@ -42,8 +43,7 @@ import org.springframework.stereotype.Component;
 @Component
 public class AtlasLdapAuthenticationProvider extends
         AtlasAbstractAuthenticationProvider {
-    private static Logger LOG = Logger
-            .getLogger(AtlasLdapAuthenticationProvider.class);
+    private static Logger LOG = LoggerFactory.getLogger(AtlasLdapAuthenticationProvider.class);
 
     private String ldapURL;
     private String ldapUserDNPattern;


Mime
View raw message