You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by el...@apache.org on 2016/01/28 00:59:29 UTC

[2/2] calcite git commit: [CALCITE-669] Mass removal of Java Logging for SLF4J

[CALCITE-669] Mass removal of Java Logging for SLF4J

Replace FINE with DEBUG, FINER and FINEST with TRACE.
Includes the slf4j-log4j12 binding for test-time. Attempts
remove all conditional logging blocks unless there is
a reason to keep them. Adds forward-looking documentation
for log-level changes.

Closes apache/calcite#186


Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/05a57992
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/05a57992
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/05a57992

Branch: refs/heads/master
Commit: 05a57992a45f9aa66db31355aa7733cfadafa1e1
Parents: f55d10c
Author: Josh Elser <el...@apache.org>
Authored: Wed Jan 27 17:43:50 2016 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Wed Jan 27 18:59:10 2016 -0500

----------------------------------------------------------------------
 avatica-server/pom.xml                          |  11 +-
 .../apache/calcite/avatica/jdbc/JdbcMeta.java   |  78 +++-----
 .../avatica/server/AvaticaJsonHandler.java      |  16 +-
 .../avatica/server/AvaticaProtobufHandler.java  |   8 +-
 .../server/DelegatingAvaticaHandler.java        |   8 +-
 .../calcite/avatica/server/HttpServer.java      |  10 +-
 .../src/test/resources/log4j.properties         |  24 +++
 avatica/pom.xml                                 |  27 +++
 .../apache/calcite/avatica/remote/Driver.java   |   5 +
 core/pom.xml                                    |  11 ++
 core/src/main/codegen/templates/Parser.jj       |   7 +-
 .../enumerable/EnumerableAggregateRule.java     |   2 +-
 .../adapter/enumerable/EnumerableJoinRule.java  |   4 +-
 .../enumerable/EnumerableMergeJoinRule.java     |   2 +-
 .../adapter/enumerable/EnumerableRules.java     |   2 +-
 .../apache/calcite/adapter/jdbc/JdbcRules.java  |   7 +-
 .../apache/calcite/interpreter/Bindables.java   |   2 +-
 .../calcite/plan/AbstractRelOptPlanner.java     |  29 +--
 .../org/apache/calcite/plan/RelOptPlanner.java  |   3 +-
 .../org/apache/calcite/plan/RelOptRuleCall.java |   3 +-
 .../calcite/plan/RexImplicationChecker.java     |  16 +-
 .../calcite/plan/SubstitutionVisitor.java       |  20 +-
 .../apache/calcite/plan/VisitorDataContext.java |  15 +-
 .../org/apache/calcite/plan/hep/HepPlanner.java |  46 ++---
 .../org/apache/calcite/plan/volcano/RelSet.java |   5 +-
 .../apache/calcite/plan/volcano/RelSubset.java  |  13 +-
 .../apache/calcite/plan/volcano/RuleQueue.java  |  42 ++---
 .../calcite/plan/volcano/VolcanoPlanner.java    |  58 ++----
 .../calcite/plan/volcano/VolcanoRuleCall.java   |  67 +++----
 .../org/apache/calcite/prepare/Prepare.java     |  11 +-
 .../org/apache/calcite/rel/AbstractRelNode.java |   8 +-
 .../apache/calcite/rel/InvalidRelException.java |   2 +-
 .../calcite/rel/rel2sql/SqlImplementor.java     |  12 +-
 .../calcite/rel/rules/CalcRelSplitter.java      |   8 +-
 .../calcite/rel/rules/ValuesReduceRule.java     |   3 +-
 .../calcite/runtime/CalciteException.java       |   9 +-
 .../calcite/runtime/ResultSetEnumerable.java    |  13 +-
 .../apache/calcite/sql/advise/SqlAdvisor.java   |   3 +-
 .../calcite/sql/parser/SqlParserUtil.java       |  24 +--
 .../calcite/sql/pretty/SqlPrettyWriter.java     |   7 +-
 .../sql/validate/SqlValidatorException.java     |   9 +-
 .../calcite/sql/validate/SqlValidatorImpl.java  |  12 +-
 .../apache/calcite/sql2rel/RelDecorrelator.java |  20 +-
 .../apache/calcite/sql2rel/RelFieldTrimmer.java |   5 +-
 .../calcite/sql2rel/SqlToRelConverter.java      |  14 +-
 .../java/org/apache/calcite/util/Benchmark.java |  23 ++-
 .../main/java/org/apache/calcite/util/Util.java |   6 +-
 .../calcite/util/trace/CalciteLogger.java       | 184 ++++++++++++-------
 .../calcite/util/trace/CalciteTimingTracer.java |  11 +-
 .../apache/calcite/util/trace/CalciteTrace.java |  38 ++--
 .../apache/calcite/test/SqlValidatorTest.java   |   6 +-
 core/src/test/resources/log4j.properties        |  24 +++
 mongodb/pom.xml                                 |  33 ++++
 .../calcite/adapter/mongodb/MongoRules.java     |   5 +-
 mongodb/src/test/resources/log4j.properties     |  24 +++
 piglet/pom.xml                                  |  11 ++
 piglet/src/main/javacc/PigletParser.jj          |   6 +-
 piglet/src/test/resources/log4j.properties      |  24 +++
 pom.xml                                         |  16 +-
 site/_docs/history.md                           |  15 +-
 site/_docs/howto.md                             |  24 ++-
 splunk/pom.xml                                  |  28 +++
 .../adapter/splunk/SplunkPushDownRule.java      |  17 +-
 .../splunk/search/SplunkConnectionImpl.java     |  18 +-
 .../calcite/adapter/splunk/util/HttpUtils.java  |   8 +-
 .../adapter/splunk/util/StringUtils.java        |   6 +-
 splunk/src/test/resources/log4j.properties      |  24 +++
 src/main/config/checkstyle/suppressions.xml     |   1 +
 68 files changed, 718 insertions(+), 535 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/avatica-server/pom.xml
----------------------------------------------------------------------
diff --git a/avatica-server/pom.xml b/avatica-server/pom.xml
index 11509d3..2386243 100644
--- a/avatica-server/pom.xml
+++ b/avatica-server/pom.xml
@@ -49,8 +49,8 @@ limitations under the License.
       <artifactId>guava</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.eclipse.jetty</groupId>
@@ -100,6 +100,11 @@ limitations under the License.
       <artifactId>jcip-annotations</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
@@ -140,6 +145,8 @@ limitations under the License.
               <ignoredUnusedDeclaredDependencies>
                 <ignoredUnusedDeclaredDependency>net.hydromatic:scott-data-hsqldb</ignoredUnusedDeclaredDependency>
                 <ignoredUnusedDeclaredDependency>org.hsqldb:hsqldb</ignoredUnusedDeclaredDependency>
+                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-api</ignoredUnusedDeclaredDependency>
+                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
               </ignoredUnusedDeclaredDependencies>
             </configuration>
           </execution>

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java b/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
index 9ff7cc9..8cac9f8 100644
--- a/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
+++ b/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
@@ -30,14 +30,14 @@ import org.apache.calcite.avatica.QueryState;
 import org.apache.calcite.avatica.SqlType;
 import org.apache.calcite.avatica.remote.TypedValue;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.RemovalListener;
 import com.google.common.cache.RemovalNotification;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.lang.reflect.InvocationTargetException;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
@@ -61,7 +61,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 /** Implementation of {@link Meta} upon an existing JDBC data source. */
 public class JdbcMeta implements Meta {
-  private static final Log LOG = LogFactory.getLog(JdbcMeta.class);
+  private static final Logger LOG = LoggerFactory.getLogger(JdbcMeta.class);
 
   private static final String CONN_CACHE_KEY_BASE = "avatica.connectioncache";
 
@@ -151,9 +151,7 @@ public class JdbcMeta implements Meta {
         .expireAfterAccess(connectionExpiryDuration, connectionExpiryUnit)
         .removalListener(new ConnectionExpiryHandler())
         .build();
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("instantiated connection cache: " + connectionCache.stats());
-    }
+    LOG.debug("instantiated connection cache: {}", connectionCache.stats());
 
     concurrencyLevel = Integer.parseInt(
         info.getProperty(StatementCacheSettings.CONCURRENCY_LEVEL.key(),
@@ -177,9 +175,8 @@ public class JdbcMeta implements Meta {
         .expireAfterAccess(connectionExpiryDuration, connectionExpiryUnit)
         .removalListener(new StatementExpiryHandler())
         .build();
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("instantiated statement cache: " + statementCache.stats());
-    }
+
+    LOG.debug("instantiated statement cache: {}", statementCache.stats());
   }
 
   /**
@@ -396,10 +393,8 @@ public class JdbcMeta implements Meta {
 
   public MetaResultSet getBestRowIdentifier(ConnectionHandle ch, String catalog, String schema,
       String table, int scope, boolean nullable) {
-    if (LOG.isTraceEnabled()) {
-      LOG.trace("getBestRowIdentifier catalog:" + catalog + " schema:" + schema
-          + " table:" + table + " scope:" + scope + " nullable:" + nullable);
-    }
+    LOG.trace("getBestRowIdentifier catalog:{} schema:{} table:{} scope:{} nullable:{}", catalog,
+        schema, table, scope, nullable);
     try {
       final ResultSet rs =
           getConnection(ch.id).getMetaData().getBestRowIdentifier(catalog, schema,
@@ -413,9 +408,7 @@ public class JdbcMeta implements Meta {
 
   public MetaResultSet getVersionColumns(ConnectionHandle ch, String catalog, String schema,
       String table) {
-    if (LOG.isTraceEnabled()) {
-      LOG.trace("getVersionColumns catalog:" + catalog + " schema:" + schema + " table:" + table);
-    }
+    LOG.trace("getVersionColumns catalog:{} schema:{} table:{}", catalog, schema, table);
     try {
       final ResultSet rs =
           getConnection(ch.id).getMetaData().getVersionColumns(catalog, schema, table);
@@ -428,9 +421,7 @@ public class JdbcMeta implements Meta {
 
   public MetaResultSet getPrimaryKeys(ConnectionHandle ch, String catalog, String schema,
       String table) {
-    if (LOG.isTraceEnabled()) {
-      LOG.trace("getPrimaryKeys catalog:" + catalog + " schema:" + schema + " table:" + table);
-    }
+    LOG.trace("getPrimaryKeys catalog:{} schema:{} table:{}", catalog, schema, table);
     try {
       final ResultSet rs =
           getConnection(ch.id).getMetaData().getPrimaryKeys(catalog, schema, table);
@@ -535,9 +526,7 @@ public class JdbcMeta implements Meta {
       final int id = statementIdGenerator.getAndIncrement();
       statementCache.put(id, new StatementInfo(statement));
       StatementHandle h = new StatementHandle(ch.id, id, null);
-      if (LOG.isTraceEnabled()) {
-        LOG.trace("created statement " + h);
-      }
+      LOG.trace("created statement {}", h);
       return h;
     } catch (SQLException e) {
       throw propagate(e);
@@ -547,12 +536,10 @@ public class JdbcMeta implements Meta {
   @Override public void closeStatement(StatementHandle h) {
     StatementInfo info = statementCache.getIfPresent(h.id);
     if (info == null || info.statement == null) {
-      LOG.debug("client requested close unknown statement " + h);
+      LOG.debug("client requested close unknown statement {}", h);
       return;
     }
-    if (LOG.isTraceEnabled()) {
-      LOG.trace("closing statement " + h);
-    }
+    LOG.trace("closing statement {}", h);
     try {
       ResultSet results = info.getResultSet();
       if (info.isResultSetInitialized() && null != results) {
@@ -590,12 +577,10 @@ public class JdbcMeta implements Meta {
   @Override public void closeConnection(ConnectionHandle ch) {
     Connection conn = connectionCache.getIfPresent(ch.id);
     if (conn == null) {
-      LOG.debug("client requested close unknown connection " + ch);
+      LOG.debug("client requested close unknown connection {}", ch);
       return;
     }
-    if (LOG.isTraceEnabled()) {
-      LOG.trace("closing connection " + ch);
-    }
+    LOG.trace("closing connection {}", ch);
     try {
       conn.close();
     } catch (SQLException e) {
@@ -626,9 +611,7 @@ public class JdbcMeta implements Meta {
 
   @Override public ConnectionProperties connectionSync(ConnectionHandle ch,
       ConnectionProperties connProps) {
-    if (LOG.isTraceEnabled()) {
-      LOG.trace("syncing properties for connection " + ch);
-    }
+    LOG.trace("syncing properties for connection {}", ch);
     try {
       Connection conn = getConnection(ch.id);
       ConnectionPropertiesImpl props = new ConnectionPropertiesImpl(conn).merge(connProps);
@@ -669,9 +652,7 @@ public class JdbcMeta implements Meta {
       StatementHandle h = new StatementHandle(ch.id, id,
           signature(statement.getMetaData(), statement.getParameterMetaData(),
               sql, statementType));
-      if (LOG.isTraceEnabled()) {
-        LOG.trace("prepared statement " + h);
-      }
+      LOG.trace("prepared statement {}", h);
       return h;
     } catch (SQLException e) {
       throw propagate(e);
@@ -706,9 +687,7 @@ public class JdbcMeta implements Meta {
         resultSets.add(
             JdbcResultSet.create(h.connectionId, h.id, info.getResultSet(), maxRowCount));
       }
-      if (LOG.isTraceEnabled()) {
-        LOG.trace("prepAndExec statement " + h);
-      }
+      LOG.trace("prepAndExec statement {}", h);
       // TODO: review client to ensure statementId is updated when appropriate
       return new ExecuteResult(resultSets);
     } catch (SQLException e) {
@@ -742,10 +721,7 @@ public class JdbcMeta implements Meta {
 
   public Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount) throws
       NoSuchStatementException, MissingResultsException {
-    if (LOG.isTraceEnabled()) {
-      LOG.trace("fetching " + h + " offset:" + offset + " fetchMaxRowCount:"
-          + fetchMaxRowCount);
-    }
+    LOG.trace("fetching {} offset:{} fetchMaxRowCount:{}", h, offset, fetchMaxRowCount);
     try {
       final StatementInfo statementInfo = statementCache.getIfPresent(h.id);
       if (null == statementInfo) {
@@ -935,16 +911,13 @@ public class JdbcMeta implements Meta {
     public void onRemoval(RemovalNotification<String, Connection> notification) {
       String connectionId = notification.getKey();
       Connection doomed = notification.getValue();
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Expiring connection " + connectionId + " because "
-                + notification.getCause());
-      }
+      LOG.debug("Expiring connection {} because {}", connectionId, notification.getCause());
       try {
         if (doomed != null) {
           doomed.close();
         }
       } catch (Throwable t) {
-        LOG.info("Exception thrown while expiring connection " + connectionId, t);
+        LOG.info("Exception thrown while expiring connection {}", connectionId, t);
       }
     }
   }
@@ -959,10 +932,7 @@ public class JdbcMeta implements Meta {
         // log/throw?
         return;
       }
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Expiring statement " + stmtId + " because "
-                + notification.getCause());
-      }
+      LOG.debug("Expiring statement {} because {}", stmtId, notification.getCause());
       try {
         if (doomed.getResultSet() != null) {
           doomed.getResultSet().close();
@@ -971,7 +941,7 @@ public class JdbcMeta implements Meta {
           doomed.statement.close();
         }
       } catch (Throwable t) {
-        LOG.info("Exception thrown while expiring statement " + stmtId);
+        LOG.info("Exception thrown while expiring statement {}", stmtId, t);
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/avatica-server/src/main/java/org/apache/calcite/avatica/server/AvaticaJsonHandler.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/main/java/org/apache/calcite/avatica/server/AvaticaJsonHandler.java b/avatica-server/src/main/java/org/apache/calcite/avatica/server/AvaticaJsonHandler.java
index 51ffba6..250c1d5 100644
--- a/avatica-server/src/main/java/org/apache/calcite/avatica/server/AvaticaJsonHandler.java
+++ b/avatica-server/src/main/java/org/apache/calcite/avatica/server/AvaticaJsonHandler.java
@@ -22,12 +22,12 @@ import org.apache.calcite.avatica.remote.JsonHandler;
 import org.apache.calcite.avatica.remote.Service;
 import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.handler.AbstractHandler;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.IOException;
 import java.util.Objects;
 
@@ -40,7 +40,7 @@ import javax.servlet.http.HttpServletResponse;
  * Jetty handler that executes Avatica JSON request-responses.
  */
 public class AvaticaJsonHandler extends AbstractHandler implements AvaticaHandler {
-  private static final Log LOG = LogFactory.getLog(AvaticaJsonHandler.class);
+  private static final Logger LOG = LoggerFactory.getLogger(AvaticaJsonHandler.class);
 
   final Service service;
   final JsonHandler jsonHandler;
@@ -66,14 +66,10 @@ public class AvaticaJsonHandler extends AbstractHandler implements AvaticaHandle
       }
       final String jsonRequest =
           new String(rawRequest.getBytes("ISO-8859-1"), "UTF-8");
-      if (LOG.isTraceEnabled()) {
-        LOG.trace("request: " + jsonRequest);
-      }
+      LOG.trace("request: {}", jsonRequest);
 
       final HandlerResponse<String> jsonResponse = jsonHandler.apply(jsonRequest);
-      if (LOG.isTraceEnabled()) {
-        LOG.trace("response: " + jsonResponse);
-      }
+      LOG.trace("response: {}", jsonResponse);
       baseRequest.setHandled(true);
       // Set the status code and write out the response.
       response.setStatus(jsonResponse.getStatusCode());

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/avatica-server/src/main/java/org/apache/calcite/avatica/server/AvaticaProtobufHandler.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/main/java/org/apache/calcite/avatica/server/AvaticaProtobufHandler.java b/avatica-server/src/main/java/org/apache/calcite/avatica/server/AvaticaProtobufHandler.java
index dcaf05e..e44de00 100644
--- a/avatica-server/src/main/java/org/apache/calcite/avatica/server/AvaticaProtobufHandler.java
+++ b/avatica-server/src/main/java/org/apache/calcite/avatica/server/AvaticaProtobufHandler.java
@@ -24,12 +24,12 @@ import org.apache.calcite.avatica.remote.ProtobufTranslationImpl;
 import org.apache.calcite.avatica.remote.Service;
 import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.handler.AbstractHandler;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.IOException;
 import java.util.Objects;
 
@@ -42,7 +42,7 @@ import javax.servlet.http.HttpServletResponse;
  * Jetty handler that executes Avatica JSON request-responses.
  */
 public class AvaticaProtobufHandler extends AbstractHandler implements AvaticaHandler {
-  private static final Log LOG = LogFactory.getLog(AvaticaJsonHandler.class);
+  private static final Logger LOG = LoggerFactory.getLogger(AvaticaJsonHandler.class);
 
   private final Service service;
   private final ProtobufHandler pbHandler;

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/avatica-server/src/main/java/org/apache/calcite/avatica/server/DelegatingAvaticaHandler.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/main/java/org/apache/calcite/avatica/server/DelegatingAvaticaHandler.java b/avatica-server/src/main/java/org/apache/calcite/avatica/server/DelegatingAvaticaHandler.java
index 7270f40..223fba7 100644
--- a/avatica-server/src/main/java/org/apache/calcite/avatica/server/DelegatingAvaticaHandler.java
+++ b/avatica-server/src/main/java/org/apache/calcite/avatica/server/DelegatingAvaticaHandler.java
@@ -18,13 +18,13 @@ package org.apache.calcite.avatica.server;
 
 import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.Server;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.IOException;
 import java.util.Objects;
 
@@ -39,7 +39,7 @@ import javax.servlet.http.HttpServletResponse;
  * {@link #setServerRpcMetadata(org.apache.calcite.avatica.remote.Service.RpcMetadataResponse)}.
  */
 public class DelegatingAvaticaHandler implements AvaticaHandler {
-  private static final Log LOG = LogFactory.getLog(DelegatingAvaticaHandler.class);
+  private static final Logger LOG = LoggerFactory.getLogger(DelegatingAvaticaHandler.class);
 
   private final Handler handler;
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/avatica-server/src/main/java/org/apache/calcite/avatica/server/HttpServer.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/main/java/org/apache/calcite/avatica/server/HttpServer.java b/avatica-server/src/main/java/org/apache/calcite/avatica/server/HttpServer.java
index cffbf60..c81e899 100644
--- a/avatica-server/src/main/java/org/apache/calcite/avatica/server/HttpServer.java
+++ b/avatica-server/src/main/java/org/apache/calcite/avatica/server/HttpServer.java
@@ -18,9 +18,6 @@ package org.apache.calcite.avatica.server;
 
 import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.server.Server;
@@ -29,6 +26,9 @@ import org.eclipse.jetty.server.handler.DefaultHandler;
 import org.eclipse.jetty.server.handler.HandlerList;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 
@@ -39,7 +39,7 @@ import java.net.UnknownHostException;
  * {@link #configureConnector(ServerConnector, int)} method in a derived class.
  */
 public class HttpServer {
-  private static final Log LOG = LogFactory.getLog(HttpServer.class);
+  private static final Logger LOG = LoggerFactory.getLogger(HttpServer.class);
 
   private Server server;
   private int port = -1;
@@ -96,7 +96,7 @@ public class HttpServer {
     }
     port = connector.getLocalPort();
 
-    LOG.info("Service listening on port " + getPort() + ".");
+    LOG.info("Service listening on port {}.", getPort());
 
     // Set the information about the address for this server
     try {

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/avatica-server/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/avatica-server/src/test/resources/log4j.properties b/avatica-server/src/test/resources/log4j.properties
new file mode 100644
index 0000000..834e2db
--- /dev/null
+++ b/avatica-server/src/test/resources/log4j.properties
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Root logger is configured at INFO and is sent to A1
+log4j.rootLogger=INFO, A1
+
+# A1 goes to the console
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# Set the pattern for each log message
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p - %m%n

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/avatica/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/pom.xml b/avatica/pom.xml
index 1fd1fca..7e229ea 100644
--- a/avatica/pom.xml
+++ b/avatica/pom.xml
@@ -53,6 +53,10 @@ limitations under the License.
       <artifactId>protobuf-java</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
@@ -67,10 +71,33 @@ limitations under the License.
       <artifactId>mockito-all</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
     <plugins>
+      <plugin>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>analyze</id>
+            <goals>
+              <goal>analyze-only</goal>
+            </goals>
+            <configuration>
+              <failOnWarning>true</failOnWarning>
+              <!-- ignore "unused but declared" warnings -->
+              <ignoredUnusedDeclaredDependencies>
+                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
+              </ignoredUnusedDeclaredDependencies>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
       <!-- Parent module has the same plugin and does the work of
            generating -sources.jar for each project. But without the
            plugin declared here, IDEs don't know the sources are

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/avatica/src/main/java/org/apache/calcite/avatica/remote/Driver.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/remote/Driver.java b/avatica/src/main/java/org/apache/calcite/avatica/remote/Driver.java
index 707a163..752e18d 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/remote/Driver.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/remote/Driver.java
@@ -24,6 +24,9 @@ import org.apache.calcite.avatica.DriverVersion;
 import org.apache.calcite.avatica.Meta;
 import org.apache.calcite.avatica.UnregisteredDriver;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.sql.Connection;
@@ -38,6 +41,7 @@ import java.util.Properties;
  * Avatica Remote JDBC driver.
  */
 public class Driver extends UnregisteredDriver {
+  private static final Logger LOG = LoggerFactory.getLogger(Driver.class);
   public static final String CONNECT_STRING_PREFIX = "jdbc:avatica:remote:";
 
   static {
@@ -99,6 +103,7 @@ public class Driver extends UnregisteredDriver {
       final AvaticaHttpClient httpClient = getHttpClient(connection, config);
       final Serialization serializationType = getSerialization(config);
 
+      LOG.debug("Instantiating {} service", serializationType);
       switch (serializationType) {
       case JSON:
         service = new RemoteService(httpClient);

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index fdcaafe..64c4e3a 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -140,6 +140,15 @@ limitations under the License.
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>sqlline</groupId>
       <artifactId>sqlline</artifactId>
       <scope>test</scope>
@@ -243,6 +252,8 @@ limitations under the License.
                 <ignoredUnusedDeclaredDependency>net.hydromatic:scott-data-hsqldb</ignoredUnusedDeclaredDependency>
                 <ignoredUnusedDeclaredDependency>net.hydromatic:foodmart-data-hsqldb</ignoredUnusedDeclaredDependency>
                 <ignoredUnusedDeclaredDependency>org.postgresql:postgresql</ignoredUnusedDeclaredDependency>
+                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-api</ignoredUnusedDeclaredDependency>
+                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
               </ignoredUnusedDeclaredDependencies>
               <ignoredUsedUndeclaredDependencies>
                 <ignoredUsedUndeclaredDependency>org.eclipse.jetty:jetty-server</ignoredUsedUndeclaredDependency>

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/codegen/templates/Parser.jj
----------------------------------------------------------------------
diff --git a/core/src/main/codegen/templates/Parser.jj b/core/src/main/codegen/templates/Parser.jj
index f41814a..ce4920b 100644
--- a/core/src/main/codegen/templates/Parser.jj
+++ b/core/src/main/codegen/templates/Parser.jj
@@ -98,6 +98,8 @@ import org.apache.calcite.util.trace.CalciteTrace;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 
+import org.slf4j.Logger;
+
 import java.io.Reader;
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -105,8 +107,6 @@ import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Collections;
 import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 import static org.apache.calcite.util.Static.RESOURCE;
 
@@ -228,8 +228,7 @@ PARSER_END(${parser.class})
 JAVACODE
 void debug_message1()
 {
-    LOGGER.log(Level.INFO,  getToken( 0 ).image
-        + " , " + getToken( 1 ).image );
+    LOGGER.info("{} , {}", getToken( 0 ).image, getToken( 1 ).image );
 }
 
 JAVACODE String unquotedIdentifier() {

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregateRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregateRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregateRule.java
index aec578a..e29b9fc 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregateRule.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregateRule.java
@@ -47,7 +47,7 @@ class EnumerableAggregateRule extends ConverterRule {
           agg.getGroupSets(),
           agg.getAggCallList());
     } catch (InvalidRelException e) {
-      EnumerableRules.LOGGER.fine(e.toString());
+      EnumerableRules.LOGGER.debug(e.toString());
       return null;
     }
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoinRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoinRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoinRule.java
index 88655ba..375568b 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoinRule.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoinRule.java
@@ -67,7 +67,7 @@ class EnumerableJoinRule extends ConverterRule {
         return new EnumerableThetaJoin(cluster, traitSet, left, right,
             join.getCondition(), join.getVariablesSet(), join.getJoinType());
       } catch (InvalidRelException e) {
-        EnumerableRules.LOGGER.fine(e.toString());
+        EnumerableRules.LOGGER.debug(e.toString());
         return null;
       }
     }
@@ -84,7 +84,7 @@ class EnumerableJoinRule extends ConverterRule {
           join.getVariablesSet(),
           join.getJoinType());
     } catch (InvalidRelException e) {
-      EnumerableRules.LOGGER.fine(e.toString());
+      EnumerableRules.LOGGER.debug(e.toString());
       return null;
     }
     if (!info.isEqui()) {

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoinRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoinRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoinRule.java
index 9dd0ce1..222111c 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoinRule.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoinRule.java
@@ -102,7 +102,7 @@ class EnumerableMergeJoinRule extends ConverterRule {
           join.getVariablesSet(),
           join.getJoinType());
     } catch (InvalidRelException e) {
-      EnumerableRules.LOGGER.fine(e.toString());
+      EnumerableRules.LOGGER.debug(e.toString());
       return null;
     }
     if (!info.isEqui()) {

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRules.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRules.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRules.java
index 289bc68..29ee347 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRules.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRules.java
@@ -19,7 +19,7 @@ package org.apache.calcite.adapter.enumerable;
 import org.apache.calcite.plan.RelOptRule;
 import org.apache.calcite.util.trace.CalciteTrace;
 
-import java.util.logging.Logger;
+import org.slf4j.Logger;
 
 /**
  * Rules and relational operators for the

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java
index db8bc89..a1a786d 100644
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java
+++ b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java
@@ -76,10 +76,11 @@ import org.apache.calcite.util.trace.CalciteTrace;
 
 import com.google.common.collect.ImmutableList;
 
+import org.slf4j.Logger;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
-import java.util.logging.Logger;
 
 /**
  * Rules and relational operators for
@@ -164,7 +165,7 @@ public class JdbcRules {
             join.getVariablesSet(),
             join.getJoinType());
       } catch (InvalidRelException e) {
-        LOGGER.fine(e.toString());
+        LOGGER.debug(e.toString());
         return null;
       }
     }
@@ -467,7 +468,7 @@ public class JdbcRules {
             convert(agg.getInput(), out), agg.indicator, agg.getGroupSet(),
             agg.getGroupSets(), agg.getAggCallList());
       } catch (InvalidRelException e) {
-        LOGGER.fine(e.toString());
+        LOGGER.debug(e.toString());
         return null;
       }
     }

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/interpreter/Bindables.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/interpreter/Bindables.java b/core/src/main/java/org/apache/calcite/interpreter/Bindables.java
index aa44c6a..249caed 100644
--- a/core/src/main/java/org/apache/calcite/interpreter/Bindables.java
+++ b/core/src/main/java/org/apache/calcite/interpreter/Bindables.java
@@ -621,7 +621,7 @@ public class Bindables {
             convert(agg.getInput(), traitSet), agg.indicator, agg.getGroupSet(),
             agg.getGroupSets(), agg.getAggCallList());
       } catch (InvalidRelException e) {
-        RelOptPlanner.LOGGER.fine(e.toString());
+        RelOptPlanner.LOGGER.debug(e.toString());
         return null;
       }
     }

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/AbstractRelOptPlanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/AbstractRelOptPlanner.java b/core/src/main/java/org/apache/calcite/plan/AbstractRelOptPlanner.java
index 38c0e7e..e8f7578 100644
--- a/core/src/main/java/org/apache/calcite/plan/AbstractRelOptPlanner.java
+++ b/core/src/main/java/org/apache/calcite/plan/AbstractRelOptPlanner.java
@@ -32,7 +32,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Level;
 import java.util.regex.Pattern;
 
 import static org.apache.calcite.util.Static.RESOURCE;
@@ -290,19 +289,15 @@ public abstract class AbstractRelOptPlanner implements RelOptPlanner {
 
     assert ruleCall.getRule().matches(ruleCall);
     if (isRuleExcluded(ruleCall.getRule())) {
-      if (LOGGER.isLoggable(Level.FINE)) {
-        LOGGER.fine("call#" + ruleCall.id
-            + ": Rule [" + ruleCall.getRule() + "] not fired"
-            + " due to exclusion filter");
-      }
+      LOGGER.debug("call#{}: Rule [{}] not fired due to exclusion filter",
+          ruleCall.id, ruleCall.getRule());
       return;
     }
 
-    if (LOGGER.isLoggable(Level.FINE)) {
-      LOGGER.fine(
-          "call#" + ruleCall.id
-          + ": Apply rule [" + ruleCall.getRule() + "] to "
-          + Arrays.toString(ruleCall.rels));
+    if (LOGGER.isDebugEnabled()) {
+      // Leave this wrapped in a conditional to prevent unnecessarily calling Arrays.toString(...)
+      LOGGER.debug("call#{}: Apply rule [{}] to {}",
+          ruleCall.id, ruleCall.getRule(), Arrays.toString(ruleCall.rels));
     }
 
     if (listener != null) {
@@ -340,11 +335,9 @@ public abstract class AbstractRelOptPlanner implements RelOptPlanner {
       RelOptRuleCall ruleCall,
       RelNode newRel,
       boolean before) {
-    if (before && LOGGER.isLoggable(Level.FINE)) {
-      LOGGER.fine("call#" + ruleCall.id
-          + ": Rule " + ruleCall.getRule() + " arguments "
-          + Arrays.toString(ruleCall.rels) + " produced "
-          + newRel);
+    if (before && LOGGER.isDebugEnabled()) {
+      LOGGER.debug("call#{}: Rule {} arguments {} produced {}",
+          ruleCall.id, ruleCall.getRule(), Arrays.toString(ruleCall.rels), newRel);
     }
 
     if (listener != null) {
@@ -365,9 +358,7 @@ public abstract class AbstractRelOptPlanner implements RelOptPlanner {
    * @param rel chosen rel
    */
   protected void notifyChosen(RelNode rel) {
-    if (LOGGER.isLoggable(Level.FINE)) {
-      LOGGER.fine("For final plan, using " + rel);
-    }
+    LOGGER.debug("For final plan, using {}", rel);
 
     if (listener != null) {
       RelOptListener.RelChosenEvent event =

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java b/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java
index bad9402..58f4449 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelOptPlanner.java
@@ -25,8 +25,9 @@ import org.apache.calcite.rex.RexNode;
 import org.apache.calcite.util.CancelFlag;
 import org.apache.calcite.util.trace.CalciteTrace;
 
+import org.slf4j.Logger;
+
 import java.util.List;
-import java.util.logging.Logger;
 import java.util.regex.Pattern;
 
 /**

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/RelOptRuleCall.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptRuleCall.java b/core/src/main/java/org/apache/calcite/plan/RelOptRuleCall.java
index f8df61f..e3f78aa 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelOptRuleCall.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelOptRuleCall.java
@@ -24,10 +24,11 @@ import org.apache.calcite.util.trace.CalciteTrace;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 
+import org.slf4j.Logger;
+
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.logging.Logger;
 
 /**
  * A <code>RelOptRuleCall</code> is an invocation of a {@link RelOptRule} with a

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/RexImplicationChecker.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/RexImplicationChecker.java b/core/src/main/java/org/apache/calcite/plan/RexImplicationChecker.java
index fe3ab7f..60655bf 100644
--- a/core/src/main/java/org/apache/calcite/plan/RexImplicationChecker.java
+++ b/core/src/main/java/org/apache/calcite/plan/RexImplicationChecker.java
@@ -36,12 +36,13 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
 
+import org.slf4j.LoggerFactory;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Logger;
 
 /**
  * Checks whether one condition logically implies another.
@@ -56,7 +57,7 @@ import java.util.logging.Logger;
  */
 public class RexImplicationChecker {
   private static final CalciteLogger LOGGER =
-      new CalciteLogger(Logger.getLogger(RexImplicationChecker.class.getName()));
+      new CalciteLogger(LoggerFactory.getLogger(RexImplicationChecker.class));
 
   final RexBuilder builder;
   final RexExecutorImpl executor;
@@ -89,7 +90,7 @@ public class RexImplicationChecker {
       return false;
     }
 
-    LOGGER.fine("Checking if " + first.toString() + " => " + second.toString());
+    LOGGER.debug("Checking if {} => {}", first.toString(), second.toString());
 
     RexCall firstCond = (RexCall) first;
     RexCall secondCond = (RexCall) second;
@@ -140,13 +141,13 @@ public class RexImplicationChecker {
         // If f could not imply even one conjunction in
         // secondDnfs, then final implication may be false
         if (!implyOneConjunction) {
-          LOGGER.fine(first + " doesnot imply " + second);
+          LOGGER.debug("{} doesnot imply {}", first, second);
           return false;
         }
       }
     }
 
-    LOGGER.fine(first + " implies " + second);
+    LOGGER.debug("{} implies {}", first, second);
     return true;
   }
 
@@ -160,8 +161,7 @@ public class RexImplicationChecker {
 
     // Check Support
     if (!checkSupport(firstUsageFinder, secondUsageFinder)) {
-      LOGGER.warning("Support for checking " + first
-          + " => " + second + " is not there");
+      LOGGER.warn("Support for checking {} => {} is not there", first, second);
       return false;
     }
 
@@ -220,7 +220,7 @@ public class RexImplicationChecker {
     } catch (Exception e) {
       // TODO: CheckSupport should not allow this exception to be thrown
       // Need to monitor it and handle all the cases raising them.
-      LOGGER.warning("Exception thrown while checking if => " + second + ": " + e.getMessage());
+      LOGGER.warn("Exception thrown while checking if => {}: {}", second, e.getMessage());
       return false;
     }
     return result != null

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java b/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
index ccbe2c2..560dda1 100644
--- a/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
+++ b/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
@@ -76,6 +76,8 @@ import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Sets;
 
+import org.slf4j.Logger;
+
 import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -83,8 +85,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 import static org.apache.calcite.rex.RexUtil.andNot;
 import static org.apache.calcite.rex.RexUtil.removeAll;
@@ -1115,12 +1115,8 @@ public class SubstitutionVisitor {
     protected MutableRel invert(List<Pair<RexNode, String>> namedProjects,
         MutableRel input,
         RexShuttle shuttle) {
-      if (LOGGER.isLoggable(Level.FINER)) {
-        LOGGER.finer("SubstitutionVisitor: invert:\n"
-            + "projects: " + namedProjects + "\n"
-            + "input: " + input + "\n"
-            + "project: " + shuttle + "\n");
-      }
+      LOGGER.trace("SubstitutionVisitor: invert:\nprojects: {}\ninput: {}\nproject: {}\n",
+          namedProjects, input, shuttle);
       final List<RexNode> exprList = new ArrayList<>();
       final RexBuilder rexBuilder = input.cluster.getRexBuilder();
       final List<RexNode> projects = Pair.left(namedProjects);
@@ -1139,12 +1135,8 @@ public class SubstitutionVisitor {
 
     protected MutableRel invert(MutableRel model, MutableRel input,
         MutableProject project) {
-      if (LOGGER.isLoggable(Level.FINER)) {
-        LOGGER.finer("SubstitutionVisitor: invert:\n"
-            + "model: " + model + "\n"
-            + "input: " + input + "\n"
-            + "project: " + project + "\n");
-      }
+      LOGGER.trace("SubstitutionVisitor: invert:\nmodel: {}\ninput: {}\nproject: {}\n",
+          model, input, project);
       final List<RexNode> exprList = new ArrayList<>();
       final RexBuilder rexBuilder = model.cluster.getRexBuilder();
       for (RelDataTypeField field : model.getRowType().getFieldList()) {

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/VisitorDataContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/VisitorDataContext.java b/core/src/main/java/org/apache/calcite/plan/VisitorDataContext.java
index 2d43389..b7af92d 100644
--- a/core/src/main/java/org/apache/calcite/plan/VisitorDataContext.java
+++ b/core/src/main/java/org/apache/calcite/plan/VisitorDataContext.java
@@ -34,18 +34,19 @@ import org.apache.calcite.util.NlsString;
 import org.apache.calcite.util.Pair;
 import org.apache.calcite.util.trace.CalciteLogger;
 
+import org.slf4j.LoggerFactory;
+
 import java.math.BigDecimal;
 import java.sql.Date;
 import java.util.Calendar;
 import java.util.List;
-import java.util.logging.Logger;
 
 /**
  * DataContext for evaluating an RexExpression
  */
 public class VisitorDataContext implements DataContext {
   private static final CalciteLogger LOGGER =
-      new CalciteLogger(Logger.getLogger(VisitorDataContext.class.getName()));
+      new CalciteLogger(LoggerFactory.getLogger(VisitorDataContext.class.getName()));
 
   private final Object[] values;
 
@@ -99,8 +100,8 @@ public class VisitorDataContext implements DataContext {
     for (Pair<RexInputRef, RexNode> elem : usageList) {
       Pair<Integer, ?> value = getValue(elem.getKey(), elem.getValue());
       if (value == null) {
-        LOGGER.warning(elem.getKey() + " is not handled for " + elem.getValue()
-            + " for checking implication");
+        LOGGER.warn("{} is not handled for {} for checking implication",
+            elem.getKey(), elem.getValue());
         return null;
       }
       int index = value.getKey();
@@ -120,7 +121,7 @@ public class VisitorDataContext implements DataContext {
       final RelDataType type = inputRef.getType();
 
       if (type.getSqlTypeName() == null) {
-        LOGGER.warning(inputRef.toString() + " returned null SqlTypeName");
+        LOGGER.warn("{} returned null SqlTypeName", inputRef.toString());
         return null;
       }
 
@@ -175,8 +176,8 @@ public class VisitorDataContext implements DataContext {
         }
       default:
         //TODO: Support few more supported cases
-        LOGGER.warning(type.getSqlTypeName() + " for value of class " + value.getClass()
-            + " is being handled in default way");
+        LOGGER.warn("{} for value of class {} is being handled in default way",
+            type.getSqlTypeName(), value.getClass());
         if (value instanceof NlsString) {
           return Pair.of(index, ((NlsString) value).getValue());
         } else {

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/hep/HepPlanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/hep/HepPlanner.java b/core/src/main/java/org/apache/calcite/plan/hep/HepPlanner.java
index 5569431..e029872 100644
--- a/core/src/main/java/org/apache/calcite/plan/hep/HepPlanner.java
+++ b/core/src/main/java/org/apache/calcite/plan/hep/HepPlanner.java
@@ -58,7 +58,6 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Level;
 
 /**
  * HepPlanner is a heuristic implementation of the {@link RelOptPlanner}
@@ -222,17 +221,13 @@ public class HepPlanner extends AbstractRelOptPlanner {
 
   void executeInstruction(
       HepInstruction.MatchLimit instruction) {
-    if (LOGGER.isLoggable(Level.FINEST)) {
-      LOGGER.finest("Setting match limit to " + instruction.limit);
-    }
+    LOGGER.trace("Setting match limit to {}", instruction.limit);
     currentProgram.matchLimit = instruction.limit;
   }
 
   void executeInstruction(
       HepInstruction.MatchOrder instruction) {
-    if (LOGGER.isLoggable(Level.FINEST)) {
-      LOGGER.finest("Setting match limit to " + instruction.order);
-    }
+    LOGGER.trace("Setting match limit to {}", instruction.order);
     currentProgram.matchOrder = instruction.order;
   }
 
@@ -245,11 +240,8 @@ public class HepPlanner extends AbstractRelOptPlanner {
       assert instruction.ruleDescription != null;
       instruction.rule =
           getRuleByDescription(instruction.ruleDescription);
-      if (LOGGER.isLoggable(Level.FINEST)) {
-        LOGGER.finest("Looking up rule with description "
-            + instruction.ruleDescription
-            + ", found " + instruction.rule);
-      }
+      LOGGER.trace("Looking up rule with description {}, found {}",
+          instruction.ruleDescription, instruction.rule);
     }
     if (instruction.rule != null) {
       applyRules(
@@ -263,9 +255,7 @@ public class HepPlanner extends AbstractRelOptPlanner {
     if (skippingGroup()) {
       return;
     }
-    if (LOGGER.isLoggable(Level.FINEST)) {
-      LOGGER.finest("Applying rule class " + instruction.ruleClass);
-    }
+    LOGGER.trace("Applying rule class {}", instruction.ruleClass);
     if (instruction.ruleSet == null) {
       instruction.ruleSet = new LinkedHashSet<>();
       for (RelOptRule rule : allRules) {
@@ -336,7 +326,7 @@ public class HepPlanner extends AbstractRelOptPlanner {
 
   void executeInstruction(
       HepInstruction.Subprogram instruction) {
-    LOGGER.finest("Entering subprogram");
+    LOGGER.trace("Entering subprogram");
     for (;;) {
       int nTransformationsBefore = nTransformations;
       executeProgram(instruction.subprogram);
@@ -345,14 +335,14 @@ public class HepPlanner extends AbstractRelOptPlanner {
         break;
       }
     }
-    LOGGER.finest("Leaving subprogram");
+    LOGGER.trace("Leaving subprogram");
   }
 
   void executeInstruction(
       HepInstruction.BeginGroup instruction) {
     assert currentProgram.group == null;
     currentProgram.group = instruction.endGroup;
-    LOGGER.finest("Entering group");
+    LOGGER.trace("Entering group");
   }
 
   void executeInstruction(
@@ -361,7 +351,7 @@ public class HepPlanner extends AbstractRelOptPlanner {
     currentProgram.group = null;
     instruction.collecting = false;
     applyRules(instruction.ruleSet, true);
-    LOGGER.finest("Leaving group");
+    LOGGER.trace("Leaving group");
   }
 
   private void applyRules(
@@ -373,9 +363,7 @@ public class HepPlanner extends AbstractRelOptPlanner {
       return;
     }
 
-    if (LOGGER.isLoggable(Level.FINEST)) {
-      LOGGER.finest("Applying rule set " + rules);
-    }
+    LOGGER.trace("Applying rule set {}", rules);
 
     boolean fullRestartAfterTransformation =
         currentProgram.matchOrder != HepMatchOrder.ARBITRARY;
@@ -651,10 +639,10 @@ public class HepPlanner extends AbstractRelOptPlanner {
       final RelMetadataQuery mq = RelMetadataQuery.instance();
       for (RelNode rel : call.getResults()) {
         RelOptCost thisCost = getCost(rel, mq);
-        if (LOGGER.isLoggable(Level.FINER)) {
-          LOGGER.finer("considering " + rel
-              + " with cumulative cost=" + thisCost
-              + " and rowcount=" + mq.getRowCount(rel));
+        if (LOGGER.isTraceEnabled()) {
+          // Keep in the isTraceEnabled for the getRowCount method call
+          LOGGER.trace("considering {} with cumulative cost={} and rowcount={}",
+              rel, thisCost, mq.getRowCount(rel));
         }
         if ((bestRel == null) || thisCost.isLt(bestCost)) {
           bestRel = rel;
@@ -892,7 +880,7 @@ public class HepPlanner extends AbstractRelOptPlanner {
     }
     nTransformationsLastGC = nTransformations;
 
-    LOGGER.finest("collecting garbage");
+    LOGGER.trace("collecting garbage");
 
     // Yer basic mark-and-sweep.
     final Set<HepRelVertex> rootSet = new HashSet<>();
@@ -942,7 +930,7 @@ public class HepPlanner extends AbstractRelOptPlanner {
   }
 
   private void dumpGraph() {
-    if (!LOGGER.isLoggable(Level.FINER)) {
+    if (!LOGGER.isTraceEnabled()) {
       return;
     }
 
@@ -964,7 +952,7 @@ public class HepPlanner extends AbstractRelOptPlanner {
           .append('\n');
     }
     sb.append("}");
-    LOGGER.finer(sb.toString());
+    LOGGER.trace(sb.toString());
   }
 
   // implement RelOptPlanner

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/volcano/RelSet.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/RelSet.java b/core/src/main/java/org/apache/calcite/plan/volcano/RelSet.java
index 35cf026..7cee6b6 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/RelSet.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/RelSet.java
@@ -28,11 +28,12 @@ import org.apache.calcite.util.trace.CalciteTrace;
 
 import com.google.common.collect.ImmutableList;
 
+import org.slf4j.Logger;
+
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.logging.Logger;
 
 /**
  * A <code>RelSet</code> is an equivalence-set of expressions; that is, a set of
@@ -232,7 +233,7 @@ class RelSet {
     assert this != otherSet;
     assert this.equivalentSet == null;
     assert otherSet.equivalentSet == null;
-    LOGGER.finer("Merge set#" + otherSet.id + " into set#" + id);
+    LOGGER.trace("Merge set#{} into set#{}", otherSet.id, id);
     otherSet.equivalentSet = this;
 
     // remove from table

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/volcano/RelSubset.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/RelSubset.java b/core/src/main/java/org/apache/calcite/plan/volcano/RelSubset.java
index b71390b..af32671 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/RelSubset.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/RelSubset.java
@@ -37,6 +37,8 @@ import org.apache.calcite.util.trace.CalciteTrace;
 
 import com.google.common.collect.Iterables;
 
+import org.slf4j.Logger;
+
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.ArrayList;
@@ -45,8 +47,6 @@ import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 /**
  * Subset of an equivalence class where all relational expressions have the
@@ -329,16 +329,13 @@ public class RelSubset extends AbstractRelNode {
       // This subset is already in the chain being propagated to. This
       // means that the graph is cyclic, and therefore the cost of this
       // relational expression - not this subset - must be infinite.
-      LOGGER.finer("cyclic: " + this);
+      LOGGER.trace("cyclic: {}", this);
       return;
     }
     try {
       final RelOptCost cost = planner.getCost(rel, mq);
       if (cost.isLt(bestCost)) {
-        if (LOGGER.isLoggable(Level.FINER)) {
-          LOGGER.finer("Subset cost improved: subset [" + this
-              + "] cost was " + bestCost + " now " + cost);
-        }
+        LOGGER.trace("Subset cost improved: subset [{}] cost was {} now {}", this, bestCost, cost);
 
         bestCost = cost;
         best = rel;
@@ -445,7 +442,7 @@ public class RelSubset extends AbstractRelNode {
           final String dump = sw.toString();
           RuntimeException e =
               new RelOptPlanner.CannotPlanException(dump);
-          LOGGER.throwing(getClass().getName(), "visit", e);
+          LOGGER.trace("Caught exception in class={}, method=visit", getClass().getName(), e);
           throw e;
         }
         p = cheapest;

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
index 9fa5b2b..ddfe14a 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
@@ -29,6 +29,8 @@ import com.google.common.collect.HashMultimap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Multimap;
 
+import org.slf4j.Logger;
+
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.ArrayDeque;
@@ -45,8 +47,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 /**
  * Priority queue of relexps whose rules have not been called, and rule-matches
@@ -220,9 +220,7 @@ class RuleQueue {
    *                importance by 25%)
    */
   public void boostImportance(Collection<RelSubset> subsets, double factor) {
-    if (LOGGER.isLoggable(Level.FINER)) {
-      LOGGER.finer("boostImportance(" + factor + ", " + subsets + ")");
-    }
+    LOGGER.trace("boostImportance({}, {})", factor, subsets);
     final List<RelSubset> boostRemovals = new ArrayList<>();
     final Iterator<RelSubset> iter = boostedSubsets.iterator();
     while (iter.hasNext()) {
@@ -345,11 +343,7 @@ class RuleQueue {
         }
       }
 
-      if (LOGGER.isLoggable(Level.FINEST)) {
-        LOGGER.finest(
-            matchList.phase.toString() + " Rule-match queued: "
-                + matchName);
-      }
+      LOGGER.trace("{} Rule-match queued: {}", matchList.phase.toString(), matchName);
 
       matchList.list.add(match);
 
@@ -402,19 +396,17 @@ class RuleQueue {
         importance = Math.max(importance, childImportance);
       }
     }
-    if (LOGGER.isLoggable(Level.FINEST)) {
-      LOGGER.finest("Importance of [" + subset + "] is " + importance);
-    }
+    LOGGER.trace("Importance of [{}] is {}", subset, importance);
     return importance;
   }
 
   private void dump() {
-    if (LOGGER.isLoggable(Level.FINER)) {
+    if (LOGGER.isTraceEnabled()) {
       StringWriter sw = new StringWriter();
       PrintWriter pw = new PrintWriter(sw);
       dump(pw);
       pw.flush();
-      LOGGER.finer(sw.toString());
+      LOGGER.trace(sw.toString());
     }
   }
 
@@ -461,7 +453,7 @@ class RuleQueue {
       if (matchList.isEmpty()) {
         return null;
       }
-      if (LOGGER.isLoggable(Level.FINEST)) {
+      if (LOGGER.isTraceEnabled()) {
         Collections.sort(matchList, MATCH_COMPARATOR);
         match = matchList.remove(0);
 
@@ -475,7 +467,7 @@ class RuleQueue {
           b.append(importance);
         }
 
-        LOGGER.finest(b.toString());
+        LOGGER.trace(b.toString());
       } else {
         // If we're not tracing, it's not worth the effort of sorting the
         // list to find the minimum.
@@ -494,9 +486,7 @@ class RuleQueue {
       }
 
       if (skipMatch(match)) {
-        if (LOGGER.isLoggable(Level.FINE)) {
-          LOGGER.fine("Skip match: " + match);
-        }
+        LOGGER.debug("Skip match: {}", match);
       } else {
         break;
       }
@@ -510,9 +500,7 @@ class RuleQueue {
     phaseMatchList.matchMap.remove(
         planner.getSubset(match.rels[0]), match);
 
-    if (LOGGER.isLoggable(Level.FINE)) {
-      LOGGER.fine("Pop match: " + match);
-    }
+    LOGGER.debug("Pop match: {}", match);
     return match;
   }
 
@@ -595,12 +583,8 @@ class RuleQueue {
       alpha = 0.99;
     }
     final double importance = parentImportance * alpha;
-    if (LOGGER.isLoggable(Level.FINEST)) {
-      LOGGER.finest("Importance of [" + child + "] to its parent ["
-          + parent + "] is " + importance + " (parent importance="
-          + parentImportance + ", child cost=" + childCost
-          + ", parent cost=" + parentCost + ")");
-    }
+    LOGGER.trace("Importance of [{}] to its parent [{}] is {} (parent importance={}, child cost={},"
+        + " parent cost={})", child, parent, importance, parentImportance, childCost, parentCost);
     return importance;
   }
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
index 74af6ce..2565ca7 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
@@ -106,7 +106,6 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Level;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -808,12 +807,8 @@ public class VolcanoPlanner extends AbstractRelOptPlanner {
           injectImportanceBoost();
         }
 
-        if (LOGGER.isLoggable(Level.FINE)) {
-          LOGGER.fine("PLANNER = " + this
-              + "; TICK = " + cumulativeTicks + "/" + tick
-              + "; PHASE = " + phase.toString()
-              + "; COST = " + root.bestCost);
-        }
+        LOGGER.debug("PLANNER = {}; TICK = {}/{}; PHASE = {}; COST = {}",
+            this, cumulativeTicks, tick, phase.toString(), root.bestCost);
 
         VolcanoRuleMatch match = ruleQueue.popMatch(phase);
         if (match == null) {
@@ -830,21 +825,19 @@ public class VolcanoPlanner extends AbstractRelOptPlanner {
 
       ruleQueue.phaseCompleted(phase);
     }
-    if (LOGGER.isLoggable(Level.FINER)) {
+    if (LOGGER.isTraceEnabled()) {
       StringWriter sw = new StringWriter();
       final PrintWriter pw = new PrintWriter(sw);
       dump(pw);
       pw.flush();
-      LOGGER.finer(sw.toString());
+      LOGGER.trace(sw.toString());
     }
     RelNode cheapest = root.buildCheapestPlan(this);
-    if (LOGGER.isLoggable(Level.FINE)) {
-      LOGGER.fine(
-          "Cheapest plan:\n"
-          + RelOptUtil.toString(cheapest, SqlExplainLevel.ALL_ATTRIBUTES));
+    if (LOGGER.isDebugEnabled()) {
+      LOGGER.debug(
+          "Cheapest plan:\n{}", RelOptUtil.toString(cheapest, SqlExplainLevel.ALL_ATTRIBUTES));
 
-      LOGGER.fine("Provenance:\n"
-          + provenance(cheapest));
+      LOGGER.debug("Provenance:\n{}", provenance(cheapest));
     }
     return cheapest;
   }
@@ -1031,7 +1024,7 @@ public class VolcanoPlanner extends AbstractRelOptPlanner {
     }
     final RelSubset subset = registerImpl(rel, set);
 
-    if (LOGGER.isLoggable(Level.FINE)) {
+    if (LOGGER.isDebugEnabled()) {
       validate();
     }
 
@@ -1424,9 +1417,7 @@ public class VolcanoPlanner extends AbstractRelOptPlanner {
       final RelNode removed = mapDigestToRel.remove(oldKey);
       assert removed == rel;
       final String newDigest = rel.recomputeDigest();
-      LOGGER.finer(
-          "Rename #" + rel.getId() + " from '" + oldDigest
-          + "' to '" + newDigest + "'");
+      LOGGER.trace("Rename #{} from '{}' to '{}'", rel.getId(), oldDigest, newDigest);
       final Pair<String, RelDataType> key = key(rel);
       final RelNode equivRel = mapDigestToRel.put(key, rel);
       if (equivRel != null) {
@@ -1434,9 +1425,8 @@ public class VolcanoPlanner extends AbstractRelOptPlanner {
 
         // There's already an equivalent with the same name, and we
         // just knocked it out. Put it back, and forget about 'rel'.
-        LOGGER.finer(
-            "After renaming rel#" + rel.getId()
-            + ", it is now equivalent to rel#" + equivRel.getId());
+        LOGGER.trace("After renaming rel#{} it is now equivalent to rel#{}",
+            rel.getId(), equivRel.getId());
         mapDigestToRel.put(key, equivRel);
 
         RelSubset equivRelSubset = getSubset(equivRel);
@@ -1703,11 +1693,8 @@ public class VolcanoPlanner extends AbstractRelOptPlanner {
           Litmus.THROW);
       RelSet equivSet = getSet(equivExp);
       if (equivSet != null) {
-        if (LOGGER.isLoggable(Level.FINER)) {
-          LOGGER.finer(
-              "Register: rel#" + rel.getId()
-              + " is equivalent to " + equivExp.getDescription());
-        }
+        LOGGER.trace(
+            "Register: rel#{} is equivalent to {}", rel.getId(), equivExp.getDescription());
         return registerSubset(set, getSubset(equivExp));
       }
     }
@@ -1719,11 +1706,9 @@ public class VolcanoPlanner extends AbstractRelOptPlanner {
       if ((set != null)
           && (set != childSet)
           && (set.equivalentSet == null)) {
-        if (LOGGER.isLoggable(Level.FINER)) {
-          LOGGER.finer(
-              "Register #" + rel.getId() + " " + rel.getDigest()
-              + " (and merge sets, because it is a conversion)");
-        }
+        LOGGER.trace(
+            "Register #{} {} (and merge sets, because it is a conversion)",
+            rel.getId(), rel.getDigest());
         merge(set, childSet);
         registerCount++;
 
@@ -1778,11 +1763,7 @@ public class VolcanoPlanner extends AbstractRelOptPlanner {
     final RelNode xx = mapDigestToRel.put(key, rel);
     assert xx == null || xx == rel : rel.getDigest();
 
-    if (LOGGER.isLoggable(Level.FINER)) {
-      LOGGER.finer(
-          "Register " + rel.getDescription()
-          + " in " + subset.getDescription());
-    }
+    LOGGER.trace("Register {} in {}", rel.getDescription(), subset.getDescription());
 
     // This relational expression may have been registered while we
     // recursively registered its children. If this is the case, we're done.
@@ -1852,8 +1833,7 @@ public class VolcanoPlanner extends AbstractRelOptPlanner {
     if ((set != subset.set)
         && (set != null)
         && (set.equivalentSet == null)) {
-      LOGGER.finer("Register #" + subset.getId() + " " + subset
-          + ", and merge sets");
+      LOGGER.trace("Register #{} {}, and merge sets", subset.getId(), subset);
       merge(set, subset.set);
       registerCount++;
     }

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleCall.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleCall.java b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleCall.java
index aa4e8ae..4fde111 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleCall.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleCall.java
@@ -33,7 +33,6 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
-import java.util.logging.Level;
 
 /**
  * <code>VolcanoRuleCall</code> implements the {@link RelOptRuleCall} interface
@@ -89,10 +88,10 @@ public class VolcanoRuleCall extends RelOptRuleCall {
 
   // implement RelOptRuleCall
   public void transformTo(RelNode rel, Map<RelNode, RelNode> equiv) {
-    if (LOGGER.isLoggable(Level.FINE)) {
-      LOGGER.fine(
-          "Transform to: rel#" + rel.getId() + " via " + getRule()
-          + (equiv.isEmpty() ? "" : " with equivalences " + equiv));
+    if (LOGGER.isDebugEnabled()) {
+      LOGGER.debug(
+          "Transform to: rel#{}" + rel.getId() + " via {}{}", rel.getId(), getRule(),
+          equiv.isEmpty() ? "" : " with equivalences " + equiv);
       if (generatedRelList != null) {
         generatedRelList.add(rel);
       }
@@ -109,14 +108,13 @@ public class VolcanoRuleCall extends RelOptRuleCall {
           getPlanner(),
           rels0Traits).go(rel);
 
-      if (LOGGER.isLoggable(Level.FINEST)) {
+      if (LOGGER.isTraceEnabled()) {
         // Cannot call RelNode.toString() yet, because rel has not
         // been registered. For now, let's make up something similar.
         String relDesc =
             "rel#" + rel.getId() + ":" + rel.getRelTypeName();
-        LOGGER.finest("call#" + id
-            + ": Rule " + getRule() + " arguments "
-            + Arrays.toString(rels) + " created " + relDesc);
+        LOGGER.trace("call#{}: Rule {} arguments {} created {}",
+            id, getRule(), Arrays.toString(rels), relDesc);
       }
 
       if (volcanoPlanner.listener != null) {
@@ -162,10 +160,7 @@ public class VolcanoRuleCall extends RelOptRuleCall {
     volcanoPlanner.checkCancel();
     try {
       if (volcanoPlanner.isRuleExcluded(getRule())) {
-        if (LOGGER.isLoggable(Level.FINE)) {
-          LOGGER.fine("Rule [" + getRule() + "] not fired"
-              + " due to exclusion filter");
-        }
+        LOGGER.debug("Rule [{}] not fired due to exclusion filter", getRule());
         return;
       }
 
@@ -174,42 +169,32 @@ public class VolcanoRuleCall extends RelOptRuleCall {
         RelSubset subset = volcanoPlanner.getSubset(rel);
 
         if (subset == null) {
-          if (LOGGER.isLoggable(Level.FINE)) {
-            LOGGER.fine(
-                "Rule [" + getRule() + "] not fired because"
-                + " operand #" + i + " (" + rel
-                + ") has no subset");
-          }
+          LOGGER.debug(
+              "Rule [{}] not fired because operand #{} ({}) has no subset",
+              getRule(), i, rel);
           return;
         }
 
         if (subset.set.equivalentSet != null) {
-          if (LOGGER.isLoggable(Level.FINE)) {
-            LOGGER.fine(
-                "Rule [" + getRule() + "] not fired because"
-                + " operand #" + i + " (" + rel
-                + ") belongs to obsolete set");
-          }
+          LOGGER.debug(
+              "Rule [{}] not fired because operand #{} ({}) belongs to obsolete set",
+              getRule(), i, rel);
           return;
         }
 
         final Double importance =
             volcanoPlanner.relImportances.get(rel);
         if ((importance != null) && (importance == 0d)) {
-          if (LOGGER.isLoggable(Level.FINE)) {
-            LOGGER.fine("Rule [" + getRule() + "] not fired because"
-                + " operand #" + i + " (" + rel
-                + ") has importance=0");
-          }
+          LOGGER.debug("Rule [{}] not fired because operand #{} ({}) has importance=0",
+              getRule(), i, rel);
           return;
         }
       }
 
-      if (LOGGER.isLoggable(Level.FINE)) {
-        LOGGER.fine(
-            "call#" + id
-            + ": Apply rule [" + getRule() + "] to "
-            + Arrays.toString(rels));
+      if (LOGGER.isDebugEnabled()) {
+        LOGGER.debug(
+            "call#{}: Apply rule [{}] to {}",
+            id, getRule(), Arrays.toString(rels));
       }
 
       if (volcanoPlanner.listener != null) {
@@ -222,19 +207,19 @@ public class VolcanoRuleCall extends RelOptRuleCall {
         volcanoPlanner.listener.ruleAttempted(event);
       }
 
-      if (LOGGER.isLoggable(Level.FINE)) {
+      if (LOGGER.isDebugEnabled()) {
         this.generatedRelList = new ArrayList<>();
       }
 
       getRule().onMatch(this);
 
-      if (LOGGER.isLoggable(Level.FINE)) {
+      if (LOGGER.isDebugEnabled()) {
         if (generatedRelList.isEmpty()) {
-          LOGGER.fine("call#" + id + " generated 0 successors.");
+          LOGGER.debug("call#{} generated 0 successors.", id);
         } else {
-          LOGGER.fine(
-              "call#" + id + " generated " + generatedRelList.size()
-              + " successors: " + generatedRelList);
+          LOGGER.debug(
+              "call#{} generated {} successors: {}",
+              id, generatedRelList.size(), generatedRelList);
         }
         this.generatedRelList = null;
       }

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/prepare/Prepare.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/prepare/Prepare.java b/core/src/main/java/org/apache/calcite/prepare/Prepare.java
index e624d1d..e95495d 100644
--- a/core/src/main/java/org/apache/calcite/prepare/Prepare.java
+++ b/core/src/main/java/org/apache/calcite/prepare/Prepare.java
@@ -59,11 +59,11 @@ import org.apache.calcite.util.trace.CalciteTrace;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 
+import org.slf4j.Logger;
+
 import java.lang.reflect.Type;
 import java.util.Collections;
 import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 /**
  * Abstract base for classes that implement
@@ -151,11 +151,8 @@ public abstract class Prepare {
     }
 
     final RelNode rootRel4 = program.run(planner, root.rel, desiredTraits);
-    if (LOGGER.isLoggable(Level.FINE)) {
-      LOGGER.fine(
-          "Plan after physical tweaks: "
-          + RelOptUtil.toString(rootRel4, SqlExplainLevel.ALL_ATTRIBUTES));
-    }
+    LOGGER.debug("Plan after physical tweaks: {}",
+        RelOptUtil.toString(rootRel4, SqlExplainLevel.ALL_ATTRIBUTES));
 
     return root.withRel(rootRel4);
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/rel/AbstractRelNode.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/AbstractRelNode.java b/core/src/main/java/org/apache/calcite/rel/AbstractRelNode.java
index 164d34e..706cd82 100644
--- a/core/src/main/java/org/apache/calcite/rel/AbstractRelNode.java
+++ b/core/src/main/java/org/apache/calcite/rel/AbstractRelNode.java
@@ -44,14 +44,14 @@ import org.apache.calcite.util.trace.CalciteTrace;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 
+import org.slf4j.Logger;
+
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 /**
  * Base class for every relational expression ({@link RelNode}).
@@ -115,9 +115,7 @@ public abstract class AbstractRelNode implements RelNode {
     this.id = nextId++;
     this.digest = getRelTypeName() + "#" + id;
     this.desc = digest;
-    if (LOGGER.isLoggable(Level.FINEST)) {
-      LOGGER.finest("new " + digest);
-    }
+    LOGGER.trace("new {}", digest);
   }
 
   //~ Methods ----------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/rel/InvalidRelException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/InvalidRelException.java b/core/src/main/java/org/apache/calcite/rel/InvalidRelException.java
index 0852967..f929dbb 100644
--- a/core/src/main/java/org/apache/calcite/rel/InvalidRelException.java
+++ b/core/src/main/java/org/apache/calcite/rel/InvalidRelException.java
@@ -36,7 +36,7 @@ package org.apache.calcite.rel;
  *
  * <p>The caller that receives an {@code InvalidRelException} (typically a rule
  * attempting to create a relational expression) should log it at
- * {@link java.util.logging.Level#FINE} level.</p>
+ * the DEBUG level.</p>
  */
 public class InvalidRelException extends Exception {
   /**

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java b/core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java
index a4a0481..03cc708 100644
--- a/core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java
+++ b/core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java
@@ -66,6 +66,9 @@ import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -76,14 +79,13 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Logger;
 
 /**
  * State for generating a SQL statement.
  */
 public abstract class SqlImplementor {
   private static final Logger LOGGER =
-      Logger.getLogger(SqlImplementor.class.getName());
+      LoggerFactory.getLogger(SqlImplementor.class);
 
   public static final SqlParserPos POS = SqlParserPos.ZERO;
 
@@ -168,8 +170,8 @@ public abstract class SqlImplementor {
       break;
 
     default:
-      LOGGER.fine("SINGLE_VALUE rewrite not supported for "
-          + sqlDialect.getDatabaseProduct());
+      LOGGER.debug("SINGLE_VALUE rewrite not supported for {}",
+          sqlDialect.getDatabaseProduct());
       return aggCall;
     }
 
@@ -184,7 +186,7 @@ public abstract class SqlImplementor {
     SqlNode caseExpr =
         new SqlCase(POS, caseOperand, whenList, thenList, elseExpr);
 
-    LOGGER.fine("SINGLE_VALUE rewritten into [" + caseExpr + "]");
+    LOGGER.debug("SINGLE_VALUE rewritten into [{}]", caseExpr);
 
     return caseExpr;
   }

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/rel/rules/CalcRelSplitter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/CalcRelSplitter.java b/core/src/main/java/org/apache/calcite/rel/rules/CalcRelSplitter.java
index 2e4e9e0..d4f42f0 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/CalcRelSplitter.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/CalcRelSplitter.java
@@ -44,6 +44,8 @@ import org.apache.calcite.util.graph.DefaultEdge;
 import org.apache.calcite.util.graph.DirectedGraph;
 import org.apache.calcite.util.graph.TopologicalOrderIterator;
 
+import org.slf4j.Logger;
+
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.ArrayList;
@@ -51,8 +53,6 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 /**
  * CalcRelSplitter operates on a
@@ -153,7 +153,7 @@ public abstract class CalcRelSplitter {
     }
 
     // Print out what we've got.
-    if (RULE_LOGGER.isLoggable(Level.FINER)) {
+    if (RULE_LOGGER.isTraceEnabled()) {
       traceLevelExpressions(
           exprs,
           exprLevels,
@@ -655,7 +655,7 @@ public abstract class CalcRelSplitter {
       traceWriter.println();
     }
     String msg = traceMsg.toString();
-    RULE_LOGGER.finer(msg);
+    RULE_LOGGER.trace(msg);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/rel/rules/ValuesReduceRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/ValuesReduceRule.java b/core/src/main/java/org/apache/calcite/rel/rules/ValuesReduceRule.java
index d1f205d..1f5c699 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/ValuesReduceRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/ValuesReduceRule.java
@@ -36,9 +36,10 @@ import org.apache.calcite.util.trace.CalciteTrace;
 
 import com.google.common.collect.ImmutableList;
 
+import org.slf4j.Logger;
+
 import java.util.ArrayList;
 import java.util.List;
-import java.util.logging.Logger;
 
 /**
  * Planner rule that folds projections and filters into an underlying

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/runtime/CalciteException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/runtime/CalciteException.java b/core/src/main/java/org/apache/calcite/runtime/CalciteException.java
index 387e8da..402fa90 100644
--- a/core/src/main/java/org/apache/calcite/runtime/CalciteException.java
+++ b/core/src/main/java/org/apache/calcite/runtime/CalciteException.java
@@ -16,7 +16,8 @@
  */
 package org.apache.calcite.runtime;
 
-import java.util.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 // NOTE:  This class gets compiled independently of everything else so that
 // resource generation can use reflection.  That means it must have no
@@ -39,7 +40,7 @@ public class CalciteException extends RuntimeException {
   private static final long serialVersionUID = -1314522633397794178L;
 
   private static final Logger LOGGER =
-      Logger.getLogger(CalciteException.class.getName());
+      LoggerFactory.getLogger(CalciteException.class);
 
   //~ Constructors -----------------------------------------------------------
 
@@ -56,8 +57,8 @@ public class CalciteException extends RuntimeException {
 
     // TODO: Force the caller to pass in a Logger as a trace argument for
     // better context.  Need to extend ResGen for this.
-    LOGGER.throwing("CalciteException", "constructor", this);
-    LOGGER.severe(toString());
+    LOGGER.trace("CalciteException", this);
+    LOGGER.error(toString());
   }
 }
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/runtime/ResultSetEnumerable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/runtime/ResultSetEnumerable.java b/core/src/main/java/org/apache/calcite/runtime/ResultSetEnumerable.java
index b805a1c..e7cdf4e 100644
--- a/core/src/main/java/org/apache/calcite/runtime/ResultSetEnumerable.java
+++ b/core/src/main/java/org/apache/calcite/runtime/ResultSetEnumerable.java
@@ -23,6 +23,9 @@ import org.apache.calcite.linq4j.function.Function0;
 import org.apache.calcite.linq4j.function.Function1;
 import org.apache.calcite.linq4j.tree.Primitive;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
@@ -32,8 +35,6 @@ import java.sql.Statement;
 import java.sql.Types;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 import javax.sql.DataSource;
 
 /**
@@ -45,8 +46,8 @@ public class ResultSetEnumerable<T> extends AbstractEnumerable<T> {
   private final DataSource dataSource;
   private final String sql;
   private final Function1<ResultSet, Function0<T>> rowBuilderFactory;
-  private static final Logger LOGGER = Logger.getLogger(
-      ResultSetEnumerable.class.getName());
+  private static final Logger LOGGER = LoggerFactory.getLogger(
+      ResultSetEnumerable.class);
 
   private static final Function1<ResultSet, Function0<Object>>
   AUTO_ROW_BUILDER_FACTORY =
@@ -137,9 +138,7 @@ public class ResultSetEnumerable<T> extends AbstractEnumerable<T> {
       try {
         statement.setQueryTimeout(10);
       } catch (SQLFeatureNotSupportedException e) {
-        if (LOGGER.isLoggable(Level.FINE)) {
-          LOGGER.fine("Failed to set query timeout.");
-        }
+        LOGGER.debug("Failed to set query timeout.");
       }
       final ResultSet resultSet = statement.executeQuery(sql);
       statement = null;

http://git-wip-us.apache.org/repos/asf/calcite/blob/05a57992/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java b/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java
index e6690a5..73a3401 100644
--- a/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java
+++ b/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java
@@ -37,12 +37,13 @@ import com.google.common.base.Predicate;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 
+import org.slf4j.Logger;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
-import java.util.logging.Logger;
 
 /**
  * An assistant which offers hints and corrections to a partially-formed SQL