org.perf4j.log4j
Class JmxAttributeStatisticsAppender

java.lang.Object
  extended by org.apache.log4j.AppenderSkeleton
      extended by org.perf4j.log4j.JmxAttributeStatisticsAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

public class JmxAttributeStatisticsAppender
extends org.apache.log4j.AppenderSkeleton

This appender is designed to be attached to an AsyncCoalescingStatisticsAppender. It takes the incoming GroupedTimingStatistics log messages and uses this data to update the value of a JMX MBean. The attributes on this MBean can then be monitored by external tools.

Author:
Alex Devine

Field Summary
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
JmxAttributeStatisticsAppender()
           
 
Method Summary
 void activateOptions()
           
protected  void append(org.apache.log4j.spi.LoggingEvent event)
           
 void close()
           
 java.lang.String getMBeanName()
          The MBeanName option is used to specify the ObjectName under which the StatisticsExposingMBean in the MBeanServer.
protected  javax.management.MBeanServer getMBeanServer()
          Gets the MBeanServer that should be used to register the StatisticsExposingMBean.
 java.lang.String getTagNamesToExpose()
          The TagNamesToExpose option is a comma-separated list of the tag names whose statistics values (e.g.
 boolean requiresLayout()
           
 void setMBeanName(java.lang.String mBeanName)
          Sets the value of the MBeanName option.
 void setTagNamesToExpose(java.lang.String tagNamesToExpose)
          Sets the value of the TagNamesToExpose option.
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmxAttributeStatisticsAppender

public JmxAttributeStatisticsAppender()
Method Detail

getMBeanName

public java.lang.String getMBeanName()
The MBeanName option is used to specify the ObjectName under which the StatisticsExposingMBean in the MBeanServer. If not specified, defaults to org.perf4j:type=StatisticsExposingMBean,name=Perf4J.

Returns:
The value of the MBeanName option

setMBeanName

public void setMBeanName(java.lang.String mBeanName)
Sets the value of the MBeanName option. This must be a valid JMX ObjectName.

Parameters:
mBeanName - The new value for the MBeanName option.

getTagNamesToExpose

public java.lang.String getTagNamesToExpose()
The TagNamesToExpose option is a comma-separated list of the tag names whose statistics values (e.g. mean, min, max, etc.) should be exposed as MBeanAttributes. See the StatisticsExposingMBean for more details.

Returns:
The value of the TagNamesToExpose expose

setTagNamesToExpose

public void setTagNamesToExpose(java.lang.String tagNamesToExpose)
Sets the value of the TagNamesToExpose option.

Parameters:
tagNamesToExpose - The new value for the TagNamesToExpose option.

activateOptions

public void activateOptions()
Specified by:
activateOptions in interface org.apache.log4j.spi.OptionHandler
Overrides:
activateOptions in class org.apache.log4j.AppenderSkeleton

append

protected void append(org.apache.log4j.spi.LoggingEvent event)
Specified by:
append in class org.apache.log4j.AppenderSkeleton

requiresLayout

public boolean requiresLayout()
Specified by:
requiresLayout in interface org.apache.log4j.Appender
Specified by:
requiresLayout in class org.apache.log4j.AppenderSkeleton

close

public void close()
Specified by:
close in interface org.apache.log4j.Appender
Specified by:
close in class org.apache.log4j.AppenderSkeleton

getMBeanServer

protected javax.management.MBeanServer getMBeanServer()
Gets the MBeanServer that should be used to register the StatisticsExposingMBean. Defaults to the Java Platform MBeanServer. Subclasses could override this to use a different server.

Returns:
The MBeanServer to use for registrations.


Copyright © 2008 perf4j.org. All Rights Reserved.