diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc index d6329c887..32e9b54d7 100644 --- a/compiler/cpp/src/generate/t_java_generator.cc +++ b/compiler/cpp/src/generate/t_java_generator.cc @@ -294,7 +294,8 @@ string t_java_generator::java_type_imports() { "import java.util.HashSet;\n" + "import java.util.Collections;\n" + "import java.util.BitSet;\n" + - "import org.apache.log4j.Logger;\n\n"; + "import org.slf4j.Logger;\n" + + "import org.slf4j.LoggerFactory;\n\n"; } /** @@ -1932,7 +1933,7 @@ void t_java_generator::generate_service_server(t_service* tservice) { "public static class Processor" << extends_processor << " implements TProcessor {" << endl; indent_up(); - indent(f_service_) << "private static final Logger LOGGER = Logger.getLogger(Processor.class.getName());" << endl; + indent(f_service_) << "private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());" << endl; indent(f_service_) << "public Processor(Iface iface)" << endl; diff --git a/configure.ac b/configure.ac index 895175040..6ab49db23 100644 --- a/configure.ac +++ b/configure.ac @@ -70,11 +70,13 @@ AX_THRIFT_LIB(java, [Java], yes) if test "$with_java" = "yes"; then AX_JAVAC_AND_JAVA AC_PATH_PROG([ANT], [ant]) - AX_CHECK_JAVA_CLASS(org.apache.log4j.Logger) - have_log4j="$success" + AX_CHECK_JAVA_CLASS(org.slf4j.Logger) + have_slf4j="$success" + AX_CHECK_JAVA_CLASS(org.slf4j.impl.SimpleLogger) + have_slf4j_simple="$success" AX_CHECK_JAVA_CLASS(org.apache.commons.lang.builder.HashCodeBuilder) have_hashcode="$success" - if test "x$have_log4j" = "xyes" && test "x$have_hashcode" = "xyes" ; then + if test "x$have_slf4j_simple" = "xyes" && test "x$have_slf4j" = "xyes" && test "x$have_hashcode" = "xyes" ; then ANT_FLAGS="$ANT_FLAGS -Dnoivy=" fi AC_SUBST(CLASSPATH) diff --git a/lib/java/ivy.xml b/lib/java/ivy.xml index 0b1be5d81..64203b9c5 100644 --- a/lib/java/ivy.xml +++ b/lib/java/ivy.xml @@ -1,7 +1,8 @@ - + + diff --git a/lib/java/src/org/apache/thrift/server/TNonblockingServer.java b/lib/java/src/org/apache/thrift/server/TNonblockingServer.java index 6d040a709..02fed3321 100644 --- a/lib/java/src/org/apache/thrift/server/TNonblockingServer.java +++ b/lib/java/src/org/apache/thrift/server/TNonblockingServer.java @@ -30,7 +30,8 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.thrift.TByteArrayOutputStream; import org.apache.thrift.TException; @@ -59,7 +60,7 @@ import org.apache.thrift.transport.TTransportException; */ public class TNonblockingServer extends TServer { private static final Logger LOGGER = - Logger.getLogger(TNonblockingServer.class.getName()); + LoggerFactory.getLogger(TNonblockingServer.class.getName()); // Flag for stopping the server private volatile boolean stopped_; diff --git a/lib/java/src/org/apache/thrift/server/TSimpleServer.java b/lib/java/src/org/apache/thrift/server/TSimpleServer.java index b3ee5ad6e..585865cb5 100644 --- a/lib/java/src/org/apache/thrift/server/TSimpleServer.java +++ b/lib/java/src/org/apache/thrift/server/TSimpleServer.java @@ -28,7 +28,9 @@ import org.apache.thrift.transport.TServerTransport; import org.apache.thrift.transport.TTransport; import org.apache.thrift.transport.TTransportFactory; import org.apache.thrift.transport.TTransportException; -import org.apache.log4j.Logger; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Simple singlethreaded server for testing. @@ -36,7 +38,7 @@ import org.apache.log4j.Logger; */ public class TSimpleServer extends TServer { - private static final Logger LOGGER = Logger.getLogger(TSimpleServer.class.getName()); + private static final Logger LOGGER = LoggerFactory.getLogger(TSimpleServer.class.getName()); private boolean stopped_ = false; diff --git a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java index ebc5a9be6..5b442a053 100644 --- a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java +++ b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java @@ -29,8 +29,9 @@ import org.apache.thrift.transport.TServerTransport; import org.apache.thrift.transport.TTransport; import org.apache.thrift.transport.TTransportException; import org.apache.thrift.transport.TTransportFactory; -import org.apache.log4j.Logger; -import org.apache.log4j.Level; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -46,7 +47,7 @@ import java.util.concurrent.TimeUnit; */ public class TThreadPoolServer extends TServer { - private static final Logger LOGGER = Logger.getLogger(TThreadPoolServer.class.getName()); + private static final Logger LOGGER = LoggerFactory.getLogger(TThreadPoolServer.class.getName()); // Executor service for handling client connections private ExecutorService executorService_; diff --git a/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java b/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java index 89cdb5828..fa5b6d7b3 100644 --- a/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java +++ b/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java @@ -19,7 +19,8 @@ package org.apache.thrift.transport; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; @@ -34,7 +35,7 @@ import java.io.OutputStream; */ public class TIOStreamTransport extends TTransport { - private static final Logger LOGGER = Logger.getLogger(TIOStreamTransport.class.getName()); + private static final Logger LOGGER = LoggerFactory.getLogger(TIOStreamTransport.class.getName()); /** Underlying inputStream */ protected InputStream inputStream_ = null; diff --git a/lib/java/src/org/apache/thrift/transport/TServerSocket.java b/lib/java/src/org/apache/thrift/transport/TServerSocket.java index 796cd659c..3eca7bc00 100644 --- a/lib/java/src/org/apache/thrift/transport/TServerSocket.java +++ b/lib/java/src/org/apache/thrift/transport/TServerSocket.java @@ -19,7 +19,8 @@ package org.apache.thrift.transport; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.net.InetSocketAddress; @@ -33,7 +34,7 @@ import java.net.SocketException; */ public class TServerSocket extends TServerTransport { - private static final Logger LOGGER = Logger.getLogger(TServerSocket.class.getName()); + private static final Logger LOGGER = LoggerFactory.getLogger(TServerSocket.class.getName()); /** * Underlying serversocket object diff --git a/lib/java/src/org/apache/thrift/transport/TSocket.java b/lib/java/src/org/apache/thrift/transport/TSocket.java index cdf1bcc4b..75ceddc6e 100644 --- a/lib/java/src/org/apache/thrift/transport/TSocket.java +++ b/lib/java/src/org/apache/thrift/transport/TSocket.java @@ -19,7 +19,8 @@ package org.apache.thrift.transport; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -34,7 +35,7 @@ import java.net.SocketException; */ public class TSocket extends TIOStreamTransport { - private static final Logger LOGGER = Logger.getLogger(TSocket.class.getName()); + private static final Logger LOGGER = LoggerFactory.getLogger(TSocket.class.getName()); /** * Wrapped Socket object