spring-projects / spring-kafka

Provides Familiar Spring Abstractions for Apache Kafka
https://projects.spring.io/spring-kafka
Apache License 2.0
2.15k stars 1.54k forks source link

Prevent Embedded Kafka logs auto delete #3294

Closed Deepak16031 closed 1 month ago

Deepak16031 commented 3 months ago

Expected Behavior

A flag to prevent logs deletion on embedded-kafka shutdown.

Current Behavior

All logs will be deleted on shutdown.

Context

artembilan commented 3 months ago

Any reasoning for this, please? In most cases the Embedded Kafka is used for testing, where those logs are created in temporary folder which indeed is cleared after test suite lifecycle end.

Deepak16031 commented 3 months ago

Not any specific reason, Is it a bad idea to keep logs for "test" profile? They were created right, i hope that they could be useful if we can have them for any kind of debugging.

artembilan commented 3 months ago

I would suggest then to use a real one or based on Testcontainers.

Even if we can fix EmbeddedKafkaZKBroker for its logic:

CoreUtils.delete(kafkaServer.config().logDirs());

the EmbeddedKafkaKraftBroker is based on the KafkaClusterTestKit which does this unconditionally anyway, out of our control:

Utils.delete(this.baseDirectory);

Still the point of embedded Kafka is to quickly verify producer and consumer in your project. The log retention and it analysis is out of this project scope.

sobychacko commented 1 month ago

Closing the issue. Please re-open if there is an issue.