Kafka Streams uses Apache Log4j 2 for logging service.
The main logger is org.apache.kafka.streams. Use log4j.properties to set the logging levels.
log4j.properties
log4j.rootLogger=INFO
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.logger.org.apache.kafka.streams=DEBUG
log4j.additivity.org.apache.kafka.streams=false
Tip
|
Save log4j.properties in src/main/resources in your Kafka Streams application’s project.
|
Kafka uses Simple Logging Facade for Java (SLF4J) for logging.
Tip
|
Use build.sbt
libraryDependencies += "org.slf4j" % "slf4j-simple" % "1.8.0-alpha2" Replace slf4j’s simple binding to switch between logging frameworks (e.g. build.sbt
val logback = "1.2.3"
libraryDependencies += "ch.qos.logback" % "logback-core" % logback
libraryDependencies += "ch.qos.logback" % "logback-classic" % logback |
Note
|
With logback’s configuration (as described in the above tip) you may see the following messages in the logs:
Commenting out build.sbt
val logback = "1.2.3"
libraryDependencies += "ch.qos.logback" % "logback-core" % logback
//libraryDependencies += "ch.qos.logback" % "logback-classic" % logback FIXME: Explain why the commenting out is required? |