You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Ismael Juma (JIRA)" <ji...@apache.org> on 2018/05/29 17:32:00 UTC

[jira] [Commented] (KAFKA-6965) log4j:WARN log messages printed when running kafka-console-producer OOB

    [ https://issues.apache.org/jira/browse/KAFKA-6965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16493904#comment-16493904 ] 

Ismael Juma commented on KAFKA-6965:
------------------------------------

Thanks for the report. I think it's just a matter of making the `logger` lazy below:
{code:java}
object Log4jControllerRegistration {
  private val logger = Logger(this.getClass.getName)

  try {
    val log4jController = Class.forName("kafka.utils.Log4jController").asInstanceOf[Class[Object]]
    val instance = log4jController.getDeclaredConstructor().newInstance()
    CoreUtils.registerMBean(instance, "kafka:type=kafka.Log4jController")
    logger.info("Registered kafka:type=kafka.Log4jController MBean")
  } catch {
    case _: Exception => logger.info("Couldn't register kafka:type=kafka.Log4jController MBean")
  }
}{code}

Needs verification though.

> log4j:WARN log messages printed when running kafka-console-producer OOB
> -----------------------------------------------------------------------
>
>                 Key: KAFKA-6965
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6965
>             Project: Kafka
>          Issue Type: Improvement
>    Affects Versions: 1.1.0
>            Reporter: Yeva Byzek
>            Priority: Major
>              Labels: newbie
>
> This error message is presented running `bin/kafka-console-producer` out of the box.  
> {noformat}
> log4j:WARN No appenders could be found for logger (kafka.utils.Log4jControllerRegistration$).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)