Skip to content

Commit faca2b6

Browse files
author
Ben McCann
committed
Remove slf4j-log4j12.jar from classpath. It causes conflicts in many situations. E.g. log4j-over-slf4j.jar and slf4j-log4j12.jar cannot be present simultaneously
1 parent ec77080 commit faca2b6

File tree

7 files changed

+25
-19
lines changed

7 files changed

+25
-19
lines changed

‎build.gradle‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ repositories {
2828
//}
2929
}
3030
dependencies {
31-
compile ('log4j:log4j:1.2.15') {
32-
exclude group: "com.sun.jdmk", module: "jmxtools"
33-
exclude group: "com.sun.jmx", module: "jmxri"
34-
exclude group: "javax.jms", module: "jms"
35-
}
3631
compile 'org.apache.zookeeper:zookeeper:3.4.8'
3732
compile 'org.slf4j:slf4j-api:1.6.1'
38-
compile 'org.slf4j:slf4j-log4j12:1.6.1'
3933

34+
testCompile 'commons-io:commons-io:1.4'
4035
testCompile 'junit:junit:4.12'
36+
testCompile ('log4j:log4j:1.2.15') {
37+
exclude group: "com.sun.jdmk", module: "jmxtools"
38+
exclude group: "com.sun.jmx", module: "jmxri"
39+
exclude group: "javax.jms", module: "jms"
40+
}
4141
testCompile 'org.assertj:assertj-core:2.0.0'
42-
testCompile 'commons-io:commons-io:1.4'
4342
testCompile 'org.mockito:mockito-core:1.8.0'
43+
testCompile 'org.slf4j:slf4j-log4j12:1.6.1'
4444

4545
//dependencies of mockito
4646
testCompile files('lib/objenesis-1.0.jar', 'lib/hamcrest-core-1.1.jar')

‎src/main/java/org/I0Itec/zkclient/ContentWatcher.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@
2020
import java.util.concurrent.locks.ReentrantLock;
2121

2222
import org.I0Itec.zkclient.exception.ZkNoNodeException;
23-
import org.apache.log4j.Logger;
23+
import org.slf4j.Logger;
24+
import org.slf4j.LoggerFactory;
2425

2526
/**
2627
* @param <T>
2728
* The data type that is being watched.
2829
*/
2930
public final class ContentWatcher<T extends Object> implements IZkDataListener {
3031

31-
private static final Logger LOG = Logger.getLogger(ContentWatcher.class);
32+
private static final Logger LOG = LoggerFactory.getLogger(ContentWatcher.class);
3233

3334
private Lock _contentLock = new ReentrantLock(true);
3435
private Condition _contentAvailable = _contentLock.newCondition();

‎src/main/java/org/I0Itec/zkclient/GatewayThread.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
import java.util.concurrent.locks.Lock;
3030
import java.util.concurrent.locks.ReentrantLock;
3131

32-
import org.apache.log4j.Logger;
32+
import org.slf4j.Logger;
33+
import org.slf4j.LoggerFactory;
3334

3435
public class GatewayThread extends Thread {
3536

36-
protected final static Logger LOG = Logger.getLogger(GatewayThread.class);
37+
protected final static Logger LOG = LoggerFactory.getLogger(GatewayThread.class);
3738

3839
private final int _port;
3940
private final int _destinationPort;

‎src/main/java/org/I0Itec/zkclient/ZkClient.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
import org.I0Itec.zkclient.serialize.SerializableSerializer;
4242
import org.I0Itec.zkclient.serialize.ZkSerializer;
4343
import org.I0Itec.zkclient.util.ZkPathUtil;
44-
import org.apache.log4j.Logger;
44+
import org.slf4j.Logger;
45+
import org.slf4j.LoggerFactory;
4546
import org.apache.zookeeper.CreateMode;
4647
import org.apache.zookeeper.KeeperException;
4748
import org.apache.zookeeper.KeeperException.ConnectionLossException;
@@ -61,7 +62,7 @@
6162
*/
6263
public class ZkClient implements Watcher {
6364

64-
private final static Logger LOG = Logger.getLogger(ZkClient.class);
65+
private final static Logger LOG = LoggerFactory.getLogger(ZkClient.class);
6566
protected static final String JAVA_LOGIN_CONFIG_PARAM = "java.security.auth.login.config";
6667
protected static final String ZK_SASL_CLIENT = "zookeeper.sasl.client";
6768
protected static final String ZK_LOGIN_CONTEXT_NAME_KEY = "zookeeper.sasl.clientconfig";

‎src/main/java/org/I0Itec/zkclient/ZkConnection.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
import java.util.concurrent.locks.ReentrantLock;
2424

2525
import org.I0Itec.zkclient.exception.ZkException;
26-
import org.apache.log4j.Logger;
26+
import org.slf4j.Logger;
27+
import org.slf4j.LoggerFactory;
2728
import org.apache.zookeeper.CreateMode;
2829
import org.apache.zookeeper.KeeperException;
2930
import org.apache.zookeeper.Op;
@@ -37,7 +38,7 @@
3738

3839
public class ZkConnection implements IZkConnection {
3940

40-
private static final Logger LOG = Logger.getLogger(ZkConnection.class);
41+
private static final Logger LOG = LoggerFactory.getLogger(ZkConnection.class);
4142

4243
/** It is recommended to use quite large sessions timeouts for ZooKeeper. */
4344
private static final int DEFAULT_SESSION_TIMEOUT = 30000;

‎src/main/java/org/I0Itec/zkclient/ZkEventThread.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
import java.util.concurrent.atomic.AtomicInteger;
2121

2222
import org.I0Itec.zkclient.exception.ZkInterruptedException;
23-
import org.apache.log4j.Logger;
23+
import org.slf4j.Logger;
24+
import org.slf4j.LoggerFactory;
2425

2526
/**
2627
* All listeners registered at the {@link ZkClient} will be notified from this event thread. This is to prevent
@@ -32,7 +33,7 @@
3233
*/
3334
class ZkEventThread extends Thread {
3435

35-
private static final Logger LOG = Logger.getLogger(ZkEventThread.class);
36+
private static final Logger LOG = LoggerFactory.getLogger(ZkEventThread.class);
3637

3738
private BlockingQueue<ZkEvent> _events = new LinkedBlockingQueue<ZkEvent>();
3839

‎src/main/java/org/I0Itec/zkclient/ZkServer.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@
2525

2626
import org.I0Itec.zkclient.exception.ZkException;
2727
import org.I0Itec.zkclient.exception.ZkInterruptedException;
28-
import org.apache.log4j.Logger;
2928
import org.apache.zookeeper.server.NIOServerCnxnFactory;
3029
import org.apache.zookeeper.server.ZooKeeperServer;
30+
import org.slf4j.Logger;
31+
import org.slf4j.LoggerFactory;
3132

3233
public class ZkServer {
3334

34-
private final static Logger LOG = Logger.getLogger(ZkServer.class);
35+
private final static Logger LOG = LoggerFactory.getLogger(ZkServer.class);
3536

3637
public static final int DEFAULT_PORT = 2181;
3738
public static final int DEFAULT_TICK_TIME = 5000;

0 commit comments

Comments
 (0)