org.yajul.log
Class JuliToLog4JService

java.lang.Object
  extended by org.yajul.log.JuliToLog4JService
All Implemented Interfaces:
Lifecycle, JuliToLog4JServiceMBean

public class JuliToLog4JService
extends java.lang.Object
implements JuliToLog4JServiceMBean

JMX MBean that plugs in the JULI->Log4j handler on start and unplugs it on stop. Here is an example of a JBoss JMX MBean declaration:

   <!-- Redirect java.util.logging to Log4J. -->
   <mbean code="org.yajul.log.JuliToLog4JService"
           name="org.yajul:service=JuliToLog4J">
       <attribute name="HandlerLevel">DEBUG</attribute>
       <depends>jboss.system:type=Log4jService,service=Logging</depends>
   </mbean>
 
Note that because of a small glitch in the JMX specification, the attribute name is 'HandlerLevel', and not 'handlerLevel' as you might expect. See http://madplanet.com/jboss-docu-wiki/Wiki.jsp?page=40.JMX.MBean
User: josh Date: Jun 4, 2008 Time: 3:41:44 PM


Constructor Summary
JuliToLog4JService()
           
 
Method Summary
 java.lang.String getHandlerLevel()
           
 void setHandlerLevel(java.lang.String level)
          Sets the logging level of the java.util.logging->Log4J 'Handler' to the specified value.
 void start()
          Called when an MBean is started
 void stop()
          Called when an MBean is stopped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JuliToLog4JService

public JuliToLog4JService()
Method Detail

start

public void start()
           throws java.lang.Exception
Description copied from interface: Lifecycle
Called when an MBean is started

Specified by:
start in interface Lifecycle
Throws:
java.lang.Exception - if something went wrong.

stop

public void stop()
Description copied from interface: Lifecycle
Called when an MBean is stopped

Specified by:
stop in interface Lifecycle

getHandlerLevel

public java.lang.String getHandlerLevel()
Specified by:
getHandlerLevel in interface JuliToLog4JServiceMBean
Returns:
The logging level of the java.util.logging->Log4J 'Handler' as a string

setHandlerLevel

public void setHandlerLevel(java.lang.String level)
Description copied from interface: JuliToLog4JServiceMBean
Sets the logging level of the java.util.logging->Log4J 'Handler' to the specified value.

Specified by:
setHandlerLevel in interface JuliToLog4JServiceMBean
Parameters:
level - the logging level for the adapter, e.g. "INFO"


Copyright © 2008. All Rights Reserved.