Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-545

add a context listener that automatically configures JMX

Details

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • logback-classic
    • None

    Description

      Setting up logback JMX for a web application requires a bit too many manual steps. It is not enough to simply add <jmxConfigurator /> to the configuration file. You should also set the context path but often you can't know that in advance. In addition you still need to write custom code to prevent memory leaks. These issues could all be addressed by a custom context listener.

      <listener>
      <listener-class>ch.qos.logback.classic.selector.servlet.JmxEnabler</listener-class>
      </listener>

      Code attached.

      Attachments

        Activity

          [LOGBACK-545] add a context listener that automatically configures JMX

          Paul Nyheim added a comment -

          The suggested implementation uses ServletContext.getContextPath, which was introduced in servlet-api 2.5 which makes it unusable on any J2EE 1.4 compatible app-server (such as WebSphere 6.1).

          While logback has a dependency on servlet-api 2.5, it is still compatible with servlet-api 2.4 AFAIK.

          Paul Nyheim added a comment - The suggested implementation uses ServletContext.getContextPath, which was introduced in servlet-api 2.5 which makes it unusable on any J2EE 1.4 compatible app-server (such as WebSphere 6.1). While logback has a dependency on servlet-api 2.5, it is still compatible with servlet-api 2.4 AFAIK.

          fixed class comment

          Philippe Marschall added a comment - fixed class comment

          attached class

          Philippe Marschall added a comment - attached class

          People

            ceki Ceki Gülcü
            marschall Philippe Marschall
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: