Ramin Arabbagheri
Ramin Arabbagheri

Reputation: 820

Log4j2 NoSQL Cassandra configuration in .properties file

I'm trying to add an appender to Karaf 4.2, to log exceptions to Cassandra (DSE). My "org.ops4j.pax.logging.cfg" file looks like this:

log4j2.rootLogger.appenderRef.cassandrass.ref = Cassandra
# Cassandra Appender
log4j2.appender.cass.type=NoSql
log4j2.appender.cass.name=Cassandra

but it fails with

org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : NoSQL provider not specified for appender [Cassandra]. Ignored FQCN: org.apache.logging.log4j.spi.AbstractLogger
Null object returned for NoSql in Appenders. Ignored FQCN: org.apache.logging.log4j.spi.AbstractLogger
Unable to locate appender "Cassandra" for logger config "root" Ignored FQCN: org.apache.logging.log4j.spi.AbstractLogger

Almost every configuration example I find is in the xml format. Does anyone have a working example they can share? It is complaining "NoSQL provider not specified" which makes perfect sense. I just don't know how to configure the provider to be Cassandra

This is the guide I'm following: https://logging.apache.org/log4j/2.x/manual/appenders.html#CassandraAppender

Upvotes: 0

Views: 249

Answers (1)

Erick Ramirez
Erick Ramirez

Reputation: 16343

It isn't clear in your post what you're trying to achieve. If you're attempting to configure logging for Cassandra, it won't work with Log4j.

Cassandra uses SLF4J with logback so you need to configure it accordingly. For details, see Configuring logging in Cassandra.

If you're using Log4j in your app, have a look at Configuring Log4j with a properties file. Cheers!

Upvotes: 2

Related Questions