diff --git a/util/pom.xml b/util/pom.xml
index bc8166f71f..6f9f9e11be 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -47,9 +47,14 @@
22.0
- log4j
- log4j
- 1.2.17
+ org.slf4j
+ slf4j-api
+ 1.7.25
+
+
+ ch.qos.logback
+ logback-classic
+ 1.2.3
@@ -92,12 +97,6 @@
maven-surefire-plugin
2.12
-
-
- loggerPath
- conf/log4j.properties
-
-
-Xms512m -Xmx1500m
methods
pertest
diff --git a/util/src/main/java/io/kubernetes/client/util/ClientBuilder.java b/util/src/main/java/io/kubernetes/client/util/ClientBuilder.java
index 80ff36c279..93c11a6948 100644
--- a/util/src/main/java/io/kubernetes/client/util/ClientBuilder.java
+++ b/util/src/main/java/io/kubernetes/client/util/ClientBuilder.java
@@ -32,12 +32,12 @@
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/** A Builder which allows the construction of {@link ApiClient}s in a fluent fashion. */
public class ClientBuilder {
-
- private static final Logger log = Logger.getLogger(ClientBuilder.class);
+ private static final Logger log = LoggerFactory.getLogger(ClientBuilder.class);
private String basePath = Config.DEFAULT_FALLBACK_HOST;
private byte[] caCertBytes = null;
diff --git a/util/src/main/java/io/kubernetes/client/util/Config.java b/util/src/main/java/io/kubernetes/client/util/Config.java
index 98cced0345..4c55efa135 100644
--- a/util/src/main/java/io/kubernetes/client/util/Config.java
+++ b/util/src/main/java/io/kubernetes/client/util/Config.java
@@ -20,9 +20,12 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class Config {
+ private static final Logger log = LoggerFactory.getLogger(Config.class);
+
public static final String SERVICEACCOUNT_ROOT = "/var/run/secrets/kubernetes.io/serviceaccount";
public static final String SERVICEACCOUNT_CA_PATH = SERVICEACCOUNT_ROOT + "/ca.crt";
public static final String SERVICEACCOUNT_TOKEN_PATH = SERVICEACCOUNT_ROOT + "/token";
@@ -32,8 +35,6 @@ public class Config {
// The last resort host to try
public static final String DEFAULT_FALLBACK_HOST = "http://localhost:8080";
- private static final Logger log = Logger.getLogger(Config.class);
-
public static ApiClient fromCluster() throws IOException {
return ClientBuilder.cluster().build();
}
diff --git a/util/src/main/java/io/kubernetes/client/util/KubeConfig.java b/util/src/main/java/io/kubernetes/client/util/KubeConfig.java
index 4c2f36f25b..fa07eed840 100644
--- a/util/src/main/java/io/kubernetes/client/util/KubeConfig.java
+++ b/util/src/main/java/io/kubernetes/client/util/KubeConfig.java
@@ -25,12 +25,15 @@
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;
/** KubeConfig represents a kubernetes client configuration */
public class KubeConfig {
+ private static final Logger log = LoggerFactory.getLogger(KubeConfig.class);
+
// Defaults for where to find a kubeconfig file
public static final String ENV_HOME = "HOME";
public static final String KUBEDIR = ".kube";
@@ -49,8 +52,6 @@ public class KubeConfig {
Map currentUser;
String currentNamespace;
- private static final Logger log = Logger.getLogger(KubeConfig.class);
-
public static void registerAuthenticator(Authenticator auth) {
synchronized (authenticators) {
authenticators.put(auth.getName(), auth);
diff --git a/util/src/main/java/io/kubernetes/client/util/WebSocketStreamHandler.java b/util/src/main/java/io/kubernetes/client/util/WebSocketStreamHandler.java
index a69d9abb66..4dcdb02833 100644
--- a/util/src/main/java/io/kubernetes/client/util/WebSocketStreamHandler.java
+++ b/util/src/main/java/io/kubernetes/client/util/WebSocketStreamHandler.java
@@ -28,20 +28,21 @@
import java.util.HashMap;
import java.util.Map;
import okio.ByteString;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* WebSocketStreamHandler understands the Kubernetes streaming protocol and separates a single
* WebSockets stream into a number of different streams using that protocol.
*/
public class WebSocketStreamHandler implements WebSockets.SocketListener, Closeable {
+ private static final Logger log = LoggerFactory.getLogger(WebSocketStreamHandler.class);
+
Map output;
Map input;
WebSocket socket;
String protocol;
- private static final Logger log = Logger.getLogger(WebSockets.class);
-
public WebSocketStreamHandler() {
output = new HashMap<>();
input = new HashMap<>();
diff --git a/util/src/main/java/io/kubernetes/client/util/WebSockets.java b/util/src/main/java/io/kubernetes/client/util/WebSockets.java
index 2d3106206d..50402fb076 100644
--- a/util/src/main/java/io/kubernetes/client/util/WebSockets.java
+++ b/util/src/main/java/io/kubernetes/client/util/WebSockets.java
@@ -32,9 +32,12 @@
import java.util.HashMap;
import java.util.List;
import okio.Buffer;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class WebSockets {
+ private static final Logger log = LoggerFactory.getLogger(WebSockets.class);
+
public static final String V4_STREAM_PROTOCOL = "v4.channel.k8s.io";
public static final String V3_STREAM_PROTOCOL = "v3.channel.k8s.io";
public static final String V2_STREAM_PROTOCOL = "v2.channel.k8s.io";
@@ -42,8 +45,6 @@ public class WebSockets {
public static final String STREAM_PROTOCOL_HEADER = "X-Stream-Protocol-Version";
public static final String SPDY_3_1 = "SPDY/3.1";
- private static final Logger log = Logger.getLogger(WebSockets.class);
-
/** A simple interface for a listener on a web socket */
public interface SocketListener {
/** Called when the socket is opened */
diff --git a/util/src/main/java/io/kubernetes/client/util/credentials/ClientCertificateAuthentication.java b/util/src/main/java/io/kubernetes/client/util/credentials/ClientCertificateAuthentication.java
index 38b169c695..d76a75c401 100644
--- a/util/src/main/java/io/kubernetes/client/util/credentials/ClientCertificateAuthentication.java
+++ b/util/src/main/java/io/kubernetes/client/util/credentials/ClientCertificateAuthentication.java
@@ -9,11 +9,12 @@
import java.security.cert.CertificateException;
import java.security.spec.InvalidKeySpecException;
import javax.net.ssl.KeyManager;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/** Uses Client Certificates to configure {@link ApiClient} authentication to the Kubernetes API. */
public class ClientCertificateAuthentication implements Authentication {
- private static final Logger log = Logger.getLogger(ClientCertificateAuthentication.class);
+ private static final Logger log = LoggerFactory.getLogger(ClientCertificateAuthentication.class);
private final byte[] certificate;
private final byte[] key;
diff --git a/util/src/main/resources/log4j.properties b/util/src/main/resources/log4j.properties
deleted file mode 100644
index b48f80b2d1..0000000000
--- a/util/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-# Root logger option
-log4j.rootLogger=INFO, stdout
-
-# Redirect log messages to console
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
diff --git a/util/src/main/resources/logback.xml b/util/src/main/resources/logback.xml
new file mode 100644
index 0000000000..d1f32e1e5b
--- /dev/null
+++ b/util/src/main/resources/logback.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
\ No newline at end of file