Details
-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
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.
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.