Skip to content


LogManager and KafkaServer

Creating Instance

LogManager takes the following to be created:

LogManager is created using apply factory method.

Creating LogManager

  config: KafkaConfig,
  initialOfflineDirs: Seq[String],
  configRepository: ConfigRepository,
  kafkaScheduler: KafkaScheduler,
  time: Time,
  brokerTopicStats: BrokerTopicStats,
  logDirFailureChannel: LogDirFailureChannel,
  keepPartitionMetadataFile: Boolean): LogManager

apply extracts log-related configuration properties (from the given KafkaConfig) and creates a LogConfig.

apply creates a LogCleaner.

In the end, apply creates a LogManager based on some configuration properties.

apply is used when:


LogManager is a KafkaMetricsGroup.

Current Logs

currentLogs: Pool[TopicPartition, UnifiedLog]

LogManager defines currentLogs internal registry of UnifiedLogs per TopicPartition.

LogManager uses the currentLogs registry when:

Looking Up Log

  topicPartition: TopicPartition,
  isFuture: Boolean = false): Option[UnifiedLog]

With the input isFuture enabled, getLog uses the futureLogs registry to look up the UnifiedLog for the input TopicPartition (if available). Otherwise, getLog uses the currentLogs registry.

getLog is used when:


  topicPartition: TopicPartition,
  isNew: Boolean = false,
  isFuture: Boolean = false,
  topicId: Option[Uuid]): UnifiedLog


getOrCreateLog is used when:


Enable ALL logging level for kafka.log.LogManager logger to see what happens inside.

Add the following line to config/


Refer to Logging.