Support Questions
Find answers, ask questions, and share your expertise

Problem with log4j

Problem with log4j

Hello to everyone.


After upgrading to JDBC42-2.6.17 impala driver I start getting some error messages from log4j while connecting to Impala. Here simple app to show the problem:

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class Tst {
public static void main(String[] args) {
Logger log = LogManager.getRootLogger();
try(Connection conn = DriverManager.getConnection("jdbc:impala://");
Statement stmt = conn.createStatement()) {
stmt.execute("select 1");
} catch (SQLException throwables) {

My log4j.propeties file:

log4j.rootLogger = DEBUG, console1 
log4j.appender.console1 = org.apache.log4j.ConsoleAppender
log4j.appender.console1.layout = org.apache.log4j.PatternLayout

 Command to launch:

/usr/java/jdk1.8.0_232-cloudera/bin/java -cp tst_log4j-1.0-SNAPSHOT.jar:log4j-1.2.17.jar:ImpalaJDBC42.jar -Dlog4j.configuration=file:/home/dl_efw/tst/ Tst


log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "com.cloudera.impala.jdbc42.internal.apache.log4j.Appender" variable.
log4j:ERROR The class "com.cloudera.impala.jdbc42.internal.apache.log4j.Appender" was loaded by
log4j:ERROR [sun.misc.Launcher$AppClassLoader@15db9742] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [sun.misc.Launcher$AppClassLoader@15db9742].
log4j:ERROR Could not instantiate appender named "console1".
log4j:WARN No appenders could be found for logger (com.cloudera.impala.jdbc42.internal.apache.thrift.transport.TSaslTransport).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See for more info.

How can I remove this messages? Did someone encounter such a problem? Impala has default log4j settings. With previous JDBC driver there was no problem. Any help appreciated!