Log4j JMX Support Agent Delegate
Requirements

Log4jJmxSupportAgentDelegate requires:

  1. com.hapiware.agent.Agent. For more information see General Java Agent.
  2. com.hapiware.jmx.log4j.JmxLog4jLogger. For more information see Log4j JMX Support.
    • Needs log4j v. 1.2 or later
  3. ASM 3.0 or newer. For more information see http://asm.ow2.org/.

Adds a JMX support for log4j in the case where source code is not available or if source code does not wanted to be changed for some other reason. Log4jJmxSupportAgentDelegate adds the JMX support during the class loading.

Notice

Only static org.apache.log4j.Logger objects will have the JMX support. This should be sufficient but if log4j loggers have been used too creatively then the source code must be refined (maybe using Log4j JMX Support directly thus eliminating the need for Log4jJmxSupportAgentDelegate altogether).

Configuring log4j JMX support agent

The support agent is configured by using the following elements:

  • <agent/delegate>
  • <agent/classpath>
  • <agent/filter> (Optional, but recommended)

For example:

<?xml version="1.0" encoding="UTF-8" ?>
<agent>
    <delegate>com.hapiware.asm.log4j.Log4jJmxSupportAgentDelegate</delegate>
    <classpath>
        <entry>/users/me/agent/target/log4j-jmx-support-delegate-1.0.0.jar</entry>
        <entry>/usr/local/asm-3.1/lib/asm-3.1.jar</entry>
    </classpath>

    <!--
        A JMX support is added to every log4j logger for every class in com.hapiware.* package.
    -->
    <filter>
        <include>^com/hapiware/.+</include>
    </filter>
</agent>

Remember classpath

Remember to add a suitable version of log4j-jmx-support-x.x.x.jar to the classpath of the target JVM. This jar file is needed to add the JMX support for log4j.

Download

Download from JMX Tools page.

License

MIT License

Copyright (c) 2010 Hapi, http://www.hapiware.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License