hector cassandra cluster error

87 Views Asked by At

Hello I am trying to connect a Java Maven application to Cassandra with hector. The code is very simple

imports......

public class App {

public static void main( String[] args ){
    Cluster cluster = HFactory.getOrCreateCluster("TestCluster",
            new CassandraHostConfigurator("localhost:9042"));
}       


    }
}

When I run it I have these exceptions:

log4j:WARN No appenders could be found for logger (me.prettyprint.cassandra.connection.CassandraHostRetryService).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

I think I need to set up something but I cannot find what it is.

1

There are 1 best solutions below

0
On

You need a log4j properties file. From the Hector docs:

Run your application with the following parameter:

-Dlog4j.configuration=file:///path/to/log4j.properties

Where log4j.properties contains:

log4j.rootLogger=DEBUG,stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout

Log4J is very powerful, check out the project site for more information.