Kafka
  1. Kafka
  2. KAFKA-429

Expose JMX operation to set logger level dynamically

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.7.2, 0.8.0
    • Fix Version/s: 0.7.2, 0.8.0
    • Component/s: core
    • Labels:
      None

      Description

      With KAFKA-16, we can change logger levels dynamically, but that is a global setting - i.e., it affects logging in all classes. It would be useful to expose a setLoggerLevel/add appenders operation that can be applied to classes/packages.

      We should also add this for the tools (and not just the broker) - e.g., mirror-maker, console consumer, etc.

      1. KAFKA-429-0.8-v1.patch
        7 kB
        Joel Koshy
      2. KAFKA-429-trunk-v1.patch
        6 kB
        Joel Koshy

        Activity

        Hide
        Joel Koshy added a comment -

        Patch for 0.8 and trunk.

        This adds a new log4j controller mbean that allows getting/setting log4j levels dynamically.

        The logging trait forces initialization of the companion object. This means tools such as console consumer and mirror maker get the mbean automatically (since most of the tools use the logging trait).

        Also, I removed the older LoggerDynamicMbean which is superseded by the new mbean.

        Finally (unrelated): log the throwable on producer send exception.

        Show
        Joel Koshy added a comment - Patch for 0.8 and trunk. This adds a new log4j controller mbean that allows getting/setting log4j levels dynamically. The logging trait forces initialization of the companion object. This means tools such as console consumer and mirror maker get the mbean automatically (since most of the tools use the logging trait). Also, I removed the older LoggerDynamicMbean which is superseded by the new mbean. Finally (unrelated): log the throwable on producer send exception.
        Hide
        Jay Kreps added a comment -
        Show
        Jay Kreps added a comment - I thought log4j supported this out of the box http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/jmx/package-summary.html
        Hide
        Joel Koshy added a comment -

        Yes - but afaik it is very limited. For e.g., we used LoggerDynamicMBean (which this patch removes) but it is a global setting and you cannot add new loggers with it.

        Show
        Joel Koshy added a comment - Yes - but afaik it is very limited. For e.g., we used LoggerDynamicMBean (which this patch removes) but it is a global setting and you cannot add new loggers with it.
        Hide
        Jay Kreps added a comment -

        Makes sense.

        Show
        Jay Kreps added a comment - Makes sense.
        Hide
        Jun Rao added a comment -

        Thanks for the patch. Committed to trunk and 0.8.

        Show
        Jun Rao added a comment - Thanks for the patch. Committed to trunk and 0.8.

          People

          • Assignee:
            Unassigned
            Reporter:
            Joel Koshy
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development