I'm using it via Spring jmx this way :
<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>
This gives me acces to the log4j MBeans to get existing loggers and
change levels. Please note I can ONLY get MBeans for existing loggers,
so I have to define categories in log4j.xml for every logger in my app
that I'd like to configure at runtime.
Maybe next log4j versions will allow a finer JMX management.
Nico.
gaspode a écrit :
Hi all,
I'd like to change the Log4J configuration remotely while my app is
running.
I started a simple JMX solution when I noticed that Log4J already
includes a
JMX package : org.apache.log4j.jmx.
Unfortunately, this package is not well documented, and I could not
find any
mention of it in "The Complete Log4J Manual" (Ceki Gülcü) that I recently
bought.
Could somebody explain me how to use it or point me to some online doc?
I understand that LoggerDynamicMBean, LayoutDynamicMBean and
LoggerDynamicMBean are all wrapper around a Logger, a Layout or an
Appender.
But most of my apps use lots of Loggers, Appenders,... do I have to
publish
a MBean for each of them? Isn't that a bit awkward? If I access them with
jconsole I will end up with lot's of hard to read info. Or is there a
Log4J
JMX GUI client somewhere that present me all that in a friendly way?
Or do I
have to create one? (and if so, is anybody interrested in joining the
project ? :-> ).
Cheers all,
me.
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]