You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by mischa <mi...@gmail.com> on 2005/09/22 13:23:10 UTC

log4j and jmx

hi,

are there any good examples how to setup log4j via jmx?
i am using my own jmx service based on mx4j and wonder what steps are 
needed to register a
LoggerDynamicMBean for my service.
mischa

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: log4j and jmx

Posted by Nicolas De Loof <ni...@capgemini.com>.
I'm using Spring BeanExporter to publish log4j configuration

    <bean id="mbeanExporter" 
class="org.springframework.jmx.export.MBeanExporter">
        <property name="beans">
            <map>
                <entry key="log4j:hiearchy=default">
                    <bean 
class="org.apache.log4j.jmx.HierarchyDynamicMBean"/>
                </entry>
            </map>
        </property>
        <property name="server" ref="mbeanServer"/>
    </bean>

MBeanExporter simply register the HierarchyDynamicMBean bean into my 
MBean server using "log4j:hiearchy=default" ObjectName.

MBeans are created for root logger, appenders and logger's hierarchy

Then I use MC4J console and invoke 'addLogger' to add a logger MBean for 
a pre-existing category. I can change logs level at runtime on this logger.


Something I think is missing is the ability to add a logger MBean for a 
category that is not pre-existing in log4j configuration. This may be 
usefull to set a simple package / class in debug on a running server. 
Current implementation requires me to setup empty categories for every 
potentialy interesting packages in my log4j.xml

Nico.


mischa a écrit :

> hi,
>
> are there any good examples how to setup log4j via jmx?
> i am using my own jmx service based on mx4j and wonder what steps are 
> needed to register a
> LoggerDynamicMBean for my service.
> mischa
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org