You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/08/10 14:03:01 UTC

[GitHub] [kafka] ijuma commented on a diff in pull request #12282: MINOR: Fail if Logging controller bean is not correctly registered

ijuma commented on code in PR #12282:
URL: https://github.com/apache/kafka/pull/12282#discussion_r942492154


##########
core/src/main/scala/kafka/utils/Logging.scala:
##########
@@ -27,7 +27,10 @@ object Log4jControllerRegistration {
   try {
     val log4jController = Class.forName("kafka.utils.Log4jController").asInstanceOf[Class[Object]]
     val instance = log4jController.getDeclaredConstructor().newInstance()
-    CoreUtils.registerMBean(instance, "kafka:type=kafka.Log4jController")
+    val success = CoreUtils.registerMBean(instance, "kafka:type=kafka.Log4jController")
+    if (!success) {
+      throw new IllegalArgumentException

Review Comment:
   This should have a message. Also, we should decide if we want to shutdown or if we want to log it. I usually prefer fail-fast, but not sure in this case. For example, what happens if there are multiple brokers running in the same jvm?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org