Commit f83e8ee8 by Madhan Neethiraj

ATLAS-1471: logging update (3) to reduce excessive info level logs, reduce…

ATLAS-1471: logging update (3) to reduce excessive info level logs, reduce overheads, switch to sl4j logger
parent 4b8b9e22
......@@ -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;
}
......
......@@ -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);
}
......
......@@ -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) {
......
......@@ -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() {
......
......@@ -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() {
}
......
......@@ -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)) {
......
......@@ -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);
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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,
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment