Sending Kafka and ZooKeeper logs to Sentry (using log4j)


Has anyone here ever tried to send Kafka and ZooKeeper logs to Sentry?

Since Apache Kafka and ZooKeeper are important services, I would like to redirect their error messages to Sentry. However, I’m not sure how to configure log4j to do so.

First I configured the file, which Kafka uses to learn its logging policy, with the following settings:

log4j.rootLogger=INFO, stdout, SentryAppender

However, Kafka’s output shows it couldn’t instantiate the Raven class queried by the Sentry Appender:

log4j:ERROR Could not instantiate class [com.getsentry.raven.log4j.SentryAppender].
java.lang.ClassNotFoundException: com.getsentry.raven.log4j.SentryAppender

According to the log4j module ( Raven can be installed using Maven. However, since I haven’t compiled Kafka by myself, there is no pom.xml I can use to place this dependency.

How should I proceed?

Thanks in advance.


We discussed this over SaaS support last week, but here are the details for anyone searching for this in the future:

I haven’t tested this in a while, but to the best of my recollection, all you’ll need to do is ensure that the raven-log4j JAR file (and all of it’s dependencies, as documented in the README) are included in the CLASSPATH environment variable when running the service scripts (e.g. bin/ or bin/, etc.) If you’re using a daemon like upstart to manage the server processes, you’ll need to ensure the CLASSPATH variable is set in those scripts.

1 Like