Commit 1c713a9a authored by Matija Obreza's avatar Matija Obreza

Moving all SLF4J loggers to commons-logging

parent 257ba0c0
......@@ -16,13 +16,13 @@
package org.genesys2.server.aspect;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.genesys2.server.model.AclAwareModel;
import org.genesys2.server.service.AclService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
@Component
public class AclAssignerAspect {
private static final Logger LOG = LoggerFactory.getLogger(AclAssignerAspect.class);
private static final Log LOG = LogFactory.getLog(AclAssignerAspect.class);
@Autowired
private AclService aclService;
......
......@@ -18,6 +18,8 @@ package org.genesys2.server.aspect;
import java.util.Arrays;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
......@@ -25,8 +27,6 @@ import org.genesys2.server.model.UserRole;
import org.genesys2.server.model.impl.User;
import org.genesys2.server.security.AuthUserDetails;
import org.genesys2.server.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
......@@ -37,7 +37,7 @@ import org.springframework.stereotype.Component;
@Aspect
@Component
public class AsAdminAspect {
private static final Logger LOG = LoggerFactory.getLogger(AsAdminAspect.class);
private static final Log LOG = LogFactory.getLog(AsAdminAspect.class);
@Autowired
private UserService userService;
......
......@@ -18,9 +18,9 @@ package org.genesys2.server.listener;
import java.util.concurrent.Callable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.genesys2.server.security.AsAdminInvoker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -29,7 +29,7 @@ public abstract class RunAsAdminListener implements InitializingBean {
@Autowired
protected AsAdminInvoker asAdminInvoker;
protected Logger _logger = LoggerFactory.getLogger(getClass());
protected Log _logger = LogFactory.getLog(getClass());
// in initializing stage @AsAdmin doesn't work properly
@Override
......
......@@ -16,16 +16,17 @@
package org.genesys2.server.security;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.security.acls.domain.AuditLogger;
import org.springframework.security.acls.model.AccessControlEntry;
import org.springframework.security.acls.model.AuditableAccessControlEntry;
import org.springframework.util.Assert;
public class Slf4jAuditLogger implements AuditLogger {
// TODO Not using slf4j, rename
public class ApacheLogAuditLogger implements AuditLogger {
private final Logger _logger = LoggerFactory.getLogger(getClass());
private static final Log LOG = LogFactory.getLog(ApacheLogAuditLogger.class);
@Override
public void logIfNeeded(boolean granted, AccessControlEntry ace) {
......@@ -35,9 +36,9 @@ public class Slf4jAuditLogger implements AuditLogger {
final AuditableAccessControlEntry auditableAce = (AuditableAccessControlEntry) ace;
if (granted && auditableAce.isAuditSuccess()) {
_logger.debug("GRANTED due to ACE: " + ace);
LOG.debug("GRANTED due to ACE: " + ace);
} else if (!granted && auditableAce.isAuditFailure()) {
_logger.debug("DENIED due to ACE: " + ace);
LOG.debug("DENIED due to ACE: " + ace);
}
}
......
......@@ -20,6 +20,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.genesys2.server.aspect.AsAdminAspect;
import org.genesys2.server.model.AclAwareModel;
import org.genesys2.server.model.acl.AclClass;
......@@ -34,8 +36,6 @@ import org.genesys2.server.security.AuthUserDetails;
import org.genesys2.server.service.AclService;
import org.genesys2.server.service.UserService;
import org.genesys2.spring.SecurityContextUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.security.access.prepost.PreAuthorize;
......@@ -51,7 +51,7 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional
public class AclServiceImpl implements AclService {
private static final Logger LOG = LoggerFactory.getLogger(AclServiceImpl.class);
private static final Log LOG = LogFactory.getLog(AclServiceImpl.class);
private static Permission[] basePermissions;
......
......@@ -22,9 +22,9 @@ import javax.mail.internet.MimeMessage;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.genesys2.server.service.EMailService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.javamail.JavaMailSender;
......@@ -36,7 +36,7 @@ import org.springframework.stereotype.Service;
@Service
public class EMailServiceImpl implements EMailService {
private final Logger _logger = LoggerFactory.getLogger(getClass());
private static final Log LOG = LogFactory.getLog(EMailServiceImpl.class);
@Autowired
private JavaMailSender mailSender;
......@@ -85,7 +85,7 @@ public class EMailServiceImpl implements EMailService {
message.setFrom(emailFrom);
message.setTo(emailTo);
_logger.info("Email to: " + ArrayUtils.toString(emailTo, "<NULL>"));
LOG.info("Email to: " + ArrayUtils.toString(emailTo, "<NULL>"));
if (emailCc != null && emailCc.length > 0) {
message.setCc(emailCc);
}
......@@ -107,7 +107,7 @@ public class EMailServiceImpl implements EMailService {
try {
mailSender.send(preparator);
} catch (final Exception e) {
_logger.error(e.getMessage(), e);
LOG.error(e.getMessage(), e);
}
}
});
......
......@@ -37,8 +37,8 @@ import org.genesys2.server.service.impl.FilterHandler.MinValueFilter;
import org.genesys2.server.service.impl.FilterHandler.StartsWithFilter;
import org.genesys2.server.service.impl.FilterHandler.ValueRangeFilter;
import org.genesys2.util.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
......@@ -62,7 +62,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Service
public class ElasticsearchSearchServiceImpl implements ElasticService, InitializingBean {
private static final Logger LOG = LoggerFactory.getLogger(ElasticsearchSearchServiceImpl.class);
private static final Log LOG = LogFactory.getLog(ElasticsearchSearchServiceImpl.class);
@Autowired
private ElasticsearchTemplate elasticsearchTemplate;
......
......@@ -20,8 +20,8 @@ import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
......@@ -33,7 +33,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
public abstract class BaseController {
protected Logger _logger = LoggerFactory.getLogger(getClass());
protected Log _logger = LogFactory.getLog(getClass());
protected static final String ANONYMOUS_USER = "anonymousUser";
......
......@@ -25,9 +25,9 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.genesys2.server.service.OAuth2ClientDetailsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
......@@ -38,7 +38,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
@Component("webApiFilter")
public class WebApiFilter extends OncePerRequestFilter {
private static final Logger _logger = LoggerFactory.getLogger(WebApiFilter.class);
private static final Log LOG = LogFactory.getLog(WebApiFilter.class);
@Autowired
private OAuth2ClientDetailsService clientDetailsService;
......@@ -80,7 +80,7 @@ public class WebApiFilter extends OncePerRequestFilter {
}
} catch (Throwable e) {
_logger.warn(e.getMessage());
LOG.warn(e.getMessage());
response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
}
......
......@@ -18,7 +18,7 @@ package org.genesys2.spring.config;
import org.apache.tomcat.jdbc.pool.DataSource;
import org.genesys2.server.cache.HazelcastAclCache;
import org.genesys2.server.security.Slf4jAuditLogger;
import org.genesys2.server.security.ApacheLogAuditLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
......@@ -56,13 +56,13 @@ public class SpringAclConfig {
}
@Bean
public Slf4jAuditLogger slf4jAuditLogger() {
return new Slf4jAuditLogger();
public ApacheLogAuditLogger auditLogger() {
return new ApacheLogAuditLogger();
}
@Bean
public DefaultPermissionGrantingStrategy permissionGrantingStrategy() {
return new DefaultPermissionGrantingStrategy(slf4jAuditLogger());
return new DefaultPermissionGrantingStrategy(auditLogger());
}
@Bean
......
......@@ -19,13 +19,13 @@ package org.genesys2.util;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import net.tanesha.recaptcha.ReCaptcha;
import net.tanesha.recaptcha.ReCaptchaImpl;
import net.tanesha.recaptcha.ReCaptchaResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* {@link ReCaptcha} wrapper
*
......@@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
*
*/
public class ReCaptchaUtil {
private final static Logger _logger = LoggerFactory.getLogger(ReCaptchaUtil.class);
private final static Log LOG = LogFactory.getLog(ReCaptchaUtil.class);
private static final String HTTPS_GOOGLE_SERVER = "https://www.google.com/recaptcha/api";
// Validate the reCAPTCHA
......@@ -43,13 +43,13 @@ public class ReCaptchaUtil {
try {
final InetAddress remoteInetAddr = InetAddress.getByName(remoteAddr);
isLocalRequest = remoteInetAddr.isLinkLocalAddress() || remoteInetAddr.isAnyLocalAddress() || remoteInetAddr.isLoopbackAddress();
_logger.warn("Remote addr: " + remoteAddr + " " + remoteInetAddr + " isLocal=" + isLocalRequest);
LOG.warn("Remote addr: " + remoteAddr + " " + remoteInetAddr + " isLocal=" + isLocalRequest);
} catch (final UnknownHostException e1) {
_logger.warn(e1.getMessage());
LOG.warn(e1.getMessage());
}
if (isLocalRequest) {
_logger.info("Ignoring localhost re-captcha.");
LOG.info("Ignoring localhost re-captcha.");
return true;
}
......
......@@ -12,7 +12,6 @@ import org.genesys2.server.persistence.acl.AclSidPersistence;
import org.genesys2.server.persistence.domain.*;
import org.genesys2.server.persistence.domain.kpi.KPIParameterRepository;
import org.genesys2.server.persistence.domain.kpi.ObservationRepository;
import org.genesys2.server.persistence.domain.mock.GenesysLowlevelRepositoryMock;
import org.genesys2.server.persistence.domain.mock.TraitServiceMock;
import org.genesys2.server.service.*;
import org.genesys2.server.service.impl.*;
......@@ -113,12 +112,6 @@ public abstract class AbstractRestTest {
return new VelocityEngine();
}
@Bean
@Qualifier("genesysLowlevelRepositoryMock")
public GenesysLowlevelRepository genesysLowlevelRepositoryMock() {
return new GenesysLowlevelRepositoryMock();
}
@Bean
@Qualifier("genesysLowlevelRepositoryCustomImpl")
public GenesysLowlevelRepository genesysLowlevelRepositoryCustomImpl() {
......
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