|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jboss.logging.Log4jService
This is a JMX MBean that provides two features: 1., It initalizes the log4j framework from the log4j properties format file specified by the ConfigurationPath attribute to that the log4j may be used by JBoss components. 2., It collects JMX notification events fired by the "service=Log" mbean and logs the msgs to the log4j root Category. This allows the Log4jService to replace all other JBoss logging services like ConsoleLogging and FileLogging.
Fields inherited from interface org.jboss.logging.Log4jServiceMBean |
OBJECT_NAME |
Constructor Summary | |
Log4jService()
|
|
Log4jService(java.lang.String path)
|
|
Log4jService(java.lang.String path,
int refreshPeriod)
|
Method Summary | |
java.lang.String |
getConfigurationPath()
Get the log4j.properties format config file path |
boolean |
getRefreshFlag()
Get the refresh flag. |
void |
handleNotification(javax.management.Notification n,
java.lang.Object handback)
This method recevies JMX notification events posted via a Logger instances fireNotification method and logs the msg through the log4j root Category. |
void |
postDeregister()
|
void |
postRegister(java.lang.Boolean b)
|
void |
preDeregister()
|
javax.management.ObjectName |
preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name)
Initializes the MBean by registering as a addNotificationListener of the Log service and then invokes start() to configure the log4j framework. |
void |
setConfigurationPath(java.lang.String path)
Set the log4j.properties format config file path |
void |
setRefreshFlag(boolean flag)
Set the refresh flag. |
void |
start()
Configures the log4j framework using the current service properties and sets the service category to the log4j root Category. |
void |
stop()
Stops the log4j framework by calling the Category.shutdown() method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Log4jService()
public Log4jService(java.lang.String path)
public Log4jService(java.lang.String path, int refreshPeriod)
path,
- the path to the log4j.properties format filerefreshPeriod,
- the refreshPeriod in seconds to wait between each check.Method Detail |
public java.lang.String getConfigurationPath()
getConfigurationPath
in interface Log4jServiceMBean
public void setConfigurationPath(java.lang.String path)
setConfigurationPath
in interface Log4jServiceMBean
public boolean getRefreshFlag()
getRefreshFlag
in interface Log4jServiceMBean
public void setRefreshFlag(boolean flag)
setRefreshFlag
in interface Log4jServiceMBean
public void start() throws java.lang.Exception
start
in interface Log4jServiceMBean
public void stop()
stop
in interface Log4jServiceMBean
Category.shutdown()
public void handleNotification(javax.management.Notification n, java.lang.Object handback)
handleNotification
in interface javax.management.NotificationListener
n,
- the log event. This provides the log source as n.getUserData(),
the log msg as n.getMessage(), and the type of message from n.getType().Logger.fireNotification(String, Object, String)
public javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name) throws java.lang.Exception
preRegister
in interface javax.management.MBeanRegistration
public void postRegister(java.lang.Boolean b)
postRegister
in interface javax.management.MBeanRegistration
public void preDeregister()
preDeregister
in interface javax.management.MBeanRegistration
public void postDeregister()
postDeregister
in interface javax.management.MBeanRegistration
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |