Luke Chen created KAFKA-13804:
---------------------------------

             Summary: Log broker shutdown reason at the end of log output
                 Key: KAFKA-13804
                 URL: https://issues.apache.org/jira/browse/KAFKA-13804
             Project: Kafka
          Issue Type: Improvement
          Components: core
            Reporter: Luke Chen
            Assignee: Luke Chen


Currently, when the broker hit exception, or SIGINT signal received, we will 
first log the exception (or the reason we started to shutdown) ex:

_INFO Terminating process due to signal SIGINT_ 

 

And then go through the shutdown process, to close all the resources (i.e. 
threads, sockets, metrics...), and in the end, output:

_[KafkaServer id=0] shut down completed (kafka.server.KafkaServer)_

 

Sometimes, during closing the resources, we will also hit some exceptions, or 
waiting for some other dependencies close, and output many more logs. In the 
end, when we tried to find out why the broker is shutdown, we have to go 
through many lines of logs from the tail, and identify the specific reason why 
the broker shutting down.

We could improve it by adding the reason why the broker is shutting down at the 
end of log, something like this:

 
{code:java}
[2022-04-07 18:19:33,005] INFO Terminating process due to signal SIGINT 
(org.apache.kafka.common.utils.LoggingSignalHandler)
[2022-04-07 18:19:33,007] INFO [KafkaServer id=0] shutting down 
(kafka.server.KafkaServer)
[2022-04-07 18:19:33,008] INFO [KafkaServer id=0] Starting controlled shutdown 
(kafka.server.KafkaServer)
[2022-04-07 18:19:33,016] INFO [KafkaServer id=0] Controlled shutdown request 
returned successfully after 6ms (kafka.server.KafkaServer)
....
[2022-04-07 18:19:33,227] INFO Broker and topic stats closed 
(kafka.server.BrokerTopicStats)
[2022-04-07 18:19:33,227] INFO App info kafka.server for 0 unregistered 
(org.apache.kafka.common.utils.AppInfoParser)
[2022-04-07 18:19:33,227] INFO [KafkaServer id=0] shut down completed 
(kafka.server.KafkaServer)



// new added log
[2022-04-07 18:19:33,227] INFO [KafkaServer id=0] the broker is shut down due 
to: signal SIGINT{code}
 

 

 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to