Use commons-logging to log messages.

Switch from SLF4J to commons-logging to align with Spring Framework.

Fixes #24.
This commit is contained in:
Mark Paluch
2016-10-27 13:24:17 +02:00
parent 359cebabca
commit c586583b1e
14 changed files with 38 additions and 107 deletions

View File

@@ -132,13 +132,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
@@ -711,4 +704,4 @@
</pluginRepositories>
</profile>
</profiles>
</project>
</project>

View File

@@ -34,17 +34,6 @@
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
@@ -99,19 +88,12 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.10</version>
<optional>true</optional>
</dependency>
</dependencies>
</project>
</project>

View File

@@ -18,8 +18,8 @@ package org.springframework.vault.authentication;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.Assert;
import org.springframework.vault.client.VaultClient;
@@ -41,8 +41,7 @@ import org.springframework.vault.support.VaultToken;
*/
public class AppIdAuthentication implements ClientAuthentication {
private final static Logger logger = LoggerFactory
.getLogger(AppIdAuthentication.class);
private final static Log logger = LogFactory.getLog(AppIdAuthentication.class);
private final AppIdAuthenticationOptions options;

View File

@@ -18,8 +18,8 @@ package org.springframework.vault.authentication;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.Assert;
import org.springframework.vault.client.VaultClient;
@@ -43,8 +43,7 @@ import org.springframework.vault.support.VaultToken;
*/
public class AppRoleAuthentication implements ClientAuthentication {
private final static Logger logger = LoggerFactory
.getLogger(AppRoleAuthentication.class);
private final static Log logger = LogFactory.getLog(AppRoleAuthentication.class);
private final AppRoleAuthenticationOptions options;

View File

@@ -20,8 +20,8 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -47,8 +47,7 @@ import org.springframework.web.client.RestTemplate;
*/
public class AwsEc2Authentication implements ClientAuthentication {
private final static Logger logger = LoggerFactory
.getLogger(AwsEc2Authentication.class);
private final static Log logger = LogFactory.getLog(AwsEc2Authentication.class);
private final AwsEc2AuthenticationOptions options;

View File

@@ -17,8 +17,8 @@ package org.springframework.vault.authentication;
import java.util.Collections;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.Assert;
import org.springframework.vault.client.VaultClient;
@@ -34,8 +34,8 @@ import org.springframework.vault.support.VaultToken;
*/
public class ClientCertificateAuthentication implements ClientAuthentication {
private final static Logger logger = LoggerFactory
.getLogger(ClientCertificateAuthentication.class);
private final static Log logger = LogFactory
.getLog(ClientCertificateAuthentication.class);
private final VaultClient vaultClient;

View File

@@ -17,8 +17,8 @@ package org.springframework.vault.authentication;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.Assert;
import org.springframework.vault.client.VaultClient;
@@ -114,8 +114,7 @@ import org.springframework.vault.support.VaultToken;
*/
public class CubbyholeAuthentication implements ClientAuthentication {
private final static Logger logger = LoggerFactory
.getLogger(CubbyholeAuthentication.class);
private final static Log logger = LogFactory.getLog(CubbyholeAuthentication.class);
private final CubbyholeAuthenticationOptions options;

View File

@@ -20,8 +20,8 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
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.DisposableBean;
import org.springframework.core.task.AsyncTaskExecutor;
@@ -59,8 +59,8 @@ public class LifecycleAwareSessionManager implements SessionManager, DisposableB
public static final int REFRESH_PERIOD_BEFORE_EXPIRY = 5;
private final static Logger logger = LoggerFactory
.getLogger(LifecycleAwareSessionManager.class);
private final static Log logger = LogFactory
.getLog(LifecycleAwareSessionManager.class);
private final ClientAuthentication clientAuthentication;
private final VaultClient vaultClient;
@@ -100,8 +100,8 @@ public class LifecycleAwareSessionManager implements SessionManager, DisposableB
"auth/token/revoke-self", token, null, Map.class);
if (!response.isSuccessful()) {
logger.warn("Cannot revoke VaultToken: {}",
buildExceptionMessage(response));
logger.warn(String.format("Cannot revoke VaultToken: %s",
buildExceptionMessage(response)));
}
}
}
@@ -130,9 +130,9 @@ public class LifecycleAwareSessionManager implements SessionManager, DisposableB
if (!response.isSuccessful()) {
if (response.getStatusCode().is4xxClientError()) {
logger.debug(
"Cannot refresh token, resetting token and performing re-login: {}",
buildExceptionMessage(response));
logger.debug(String
.format("Cannot refresh token, resetting token and performing re-login: %s",
buildExceptionMessage(response)));
token = null;
return false;
}

View File

@@ -22,8 +22,8 @@ import java.net.NetworkInterface;
import java.util.Collections;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -39,7 +39,7 @@ import org.springframework.util.StringUtils;
*/
public class MacAddressUserId implements AppIdUserIdMechanism {
private final Logger log = LoggerFactory.getLogger(MacAddressUserId.class);
private final Log log = LogFactory.getLog(MacAddressUserId.class);
private final String networkInterfaceHint;

View File

@@ -31,12 +31,12 @@ import javax.net.ssl.TrustManagerFactory;
import com.squareup.okhttp.OkHttpClient;
import io.netty.handler.ssl.SslContextBuilder;
import io.netty.handler.ssl.SslProvider;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.Resource;
import org.springframework.http.client.ClientHttpRequestFactory;
@@ -59,8 +59,8 @@ import org.springframework.vault.support.SslConfiguration;
*/
public class ClientHttpRequestFactoryFactory {
private static final Logger logger = LoggerFactory
.getLogger(ClientHttpRequestFactoryFactory.class);
private static final Log logger = LogFactory
.getLog(ClientHttpRequestFactoryFactory.class);
private static final boolean HTTP_COMPONENTS_PRESENT = ClassUtils.isPresent(
"org.apache.http.client.HttpClient",

View File

@@ -19,8 +19,8 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.PropertySource;
@@ -40,8 +40,7 @@ import org.springframework.vault.support.VaultResponse;
*/
public class VaultPropertySource extends EnumerablePropertySource<VaultOperations> {
protected final static Logger logger = LoggerFactory
.getLogger(VaultPropertySource.class);
protected final static Log logger = LogFactory.getLog(VaultPropertySource.class);
private final String path;
private final Map<String, String> properties = new LinkedHashMap<String, String>();

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %5p %40.40c:%4L - %m%n</pattern>
</encoder>
</appender>
<!--
<logger name="org.springframework" level="debug" />
-->
<root level="error">
<appender-ref ref="console" />
</root>
</configuration>

View File

@@ -1 +1 @@
handlers=org.slf4j.bridge.SLF4JBridgeHandler
handlers=org.apache.commons.logging.impl.SimpleLog

View File

@@ -18,7 +18,6 @@
<netty.version>4.1.4.Final</netty.version>
<okhttp.version>2.7.5</okhttp.version>
<jackson.version>2.8.2</jackson.version>
<slf4j.version>1.7.21</slf4j.version>
</properties>
<dependencyManagement>
@@ -42,26 +41,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>