[jboss-cvs] JBossAS SVN: r103539 - in trunk/varia/src: resources/services/loggingmonitor/deploy and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 5 17:38:47 EDT 2010
Author: david.lloyd at jboss.com
Date: 2010-04-05 17:38:47 -0400 (Mon, 05 Apr 2010)
New Revision: 103539
Removed:
trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitor.java
trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitorMBean.java
trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitorTimerTask.java
trunk/varia/src/main/java/org/jboss/services/loggingmonitor/MonitoredMBean.java
trunk/varia/src/main/java/org/jboss/services/loggingmonitor/RolloverPeriod.java
trunk/varia/src/resources/services/loggingmonitor/deploy/default-ds-monitor-service.xml
trunk/varia/src/resources/services/loggingmonitor/deploy/jvm-monitor-service.xml
Log:
JBAS-7896: remove old LoggingMonitor
Deleted: trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitor.java
===================================================================
--- trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitor.java 2010-04-05 19:24:49 UTC (rev 103538)
+++ trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitor.java 2010-04-05 21:38:47 UTC (rev 103539)
@@ -1,345 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.services.loggingmonitor;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-import javax.management.MalformedObjectNameException;
-
-import org.apache.log4j.Appender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-import org.jboss.logging.appender.DailyRollingFileAppender;
-import org.jboss.system.ServiceMBeanSupport;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-
-/**
- * This class implements the LoggingMonitor service which provides the ability
- * to create monitoring logs for various MBeans and their attributes.
- *
- * @author <a href="mailto:jimmy.wilson at acxiom.com">James Wilson</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public class LoggingMonitor extends ServiceMBeanSupport
- implements LoggingMonitorMBean
-{
- // Static --------------------------------------------------------
-
- public final static String MONITORED_MBEAN_ELEMENT = "monitoredmbean";
- public final static String MBEAN_NAME_ATTRIBUTE = "name";
- public final static String MBEAN_LOGGER_ATTRIBUTE = "logger";
- public final static String MBEAN_ATTRIBUTE_ELEMENT = "attribute";
-
- public final static String DEFAULT_PATTERN_LAYOUT = "%d %-5p [%c] %m%n";
-
- // Private data --------------------------------------------------
-
- private String filename;
- private boolean appendToFile;
- private RolloverPeriod rolloverPeriod;
- private MonitoredMBean[] monitoredObjects;
- private long monitorPeriod;
- private String patternLayout;
-
- private Appender appender;
- private Timer timer;
-
- // Constructors -------------------------------------------------
-
- /**
- * Default constructor.
- */
- public LoggingMonitor()
- {
- appendToFile = true;
- rolloverPeriod = new RolloverPeriod("DAY");
- patternLayout = DEFAULT_PATTERN_LAYOUT;
- }
-
- // Attributes ----------------------------------------------------
-
- /**
- * @jmx.managed-attribute
- */
- public void setFilename(String filename)
- {
- if (filename == null || filename.length() == 0)
- {
- throw new IllegalArgumentException("Logging monitor's filename can not be null or empty");
- }
- this.filename = filename;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public String getFilename()
- {
- return filename;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public void setAppendToFile(boolean appendToFile)
- {
- this.appendToFile = appendToFile;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public boolean getAppendToFile()
- {
- return appendToFile;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public void setRolloverPeriod(String rolloverPeriod)
- {
- this.rolloverPeriod = new RolloverPeriod(rolloverPeriod);
- }
-
- /**
- * @jmx.managed-attribute
- */
- public String getRolloverPeriod()
- {
- return rolloverPeriod.toString();
- }
-
- /**
- * @jmx.managed-attribute
- */
- public void setMonitorPeriod(long monitorPeriod)
- {
- if (monitorPeriod < 1)
- {
- throw new IllegalArgumentException("Logging monitor's monitor period must be a positive, non-zero value");
- }
- this.monitorPeriod = monitorPeriod;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public long getMonitorPeriod()
- {
- return monitorPeriod;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public void setPatternLayout(String patternLayout)
- {
- this.patternLayout = patternLayout;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public String getPatternLayout()
- {
- return patternLayout;
- }
-
- /**
- * @jmx.managed-attribute
- */
- public String getRolloverFormat()
- {
- return rolloverPeriod.getRolloverFormat();
- }
-
- /**
- * @jmx.managed-attribute
- */
- public void setMonitoredObjects(Element monitoredObjects) throws MalformedObjectNameException
- {
- NodeList monitoredMBeans = monitoredObjects.getElementsByTagName(MONITORED_MBEAN_ELEMENT);
-
- int mbeanCount = monitoredMBeans.getLength();
- if (mbeanCount < 1)
- {
- throw createMissingElementException(MONITORED_MBEAN_ELEMENT);
- }
-
- this.monitoredObjects = new MonitoredMBean[mbeanCount];
- for (int i = 0; i < mbeanCount; ++i)
- {
- Node monitoredMBean = monitoredMBeans.item(i);
- this.monitoredObjects[i] = toMonitoredMBean((Element) monitoredMBean);
- }
- }
-
- // ServiceMBeanSupport overrides ---------------------------------
-
- protected void startService()
- {
- if (monitoredObjects == null)
- {
- throw new IllegalStateException("'MonitoredObjects' attribute not configured");
- }
- DailyRollingFileAppender appender = new DailyRollingFileAppender();
- appender.setFile(filename);
- appender.setAppend(appendToFile);
- appender.setDatePattern(rolloverPeriod.getRolloverFormat());
- appender.setLayout(new PatternLayout(patternLayout));
- appender.setThreshold(Level.INFO);
- appender.activateOptions();
- this.appender = appender;
-
- for (int i = 0; i < monitoredObjects.length; ++i)
- {
- monitoredObjects[i].getLogger().addAppender(appender);
- }
-
- // use the ServiceMBeanSupport logger for reporting errors
- TimerTask task = new LoggingMonitorTimerTask(monitoredObjects, log);
-
- timer = new Timer();
- timer.schedule(task, 0, monitorPeriod);
-
- log.debug("Logging monitor started logging to " + filename);
- }
-
- protected void stopService()
- {
- timer.cancel();
-
- for (int i = 0; i < monitoredObjects.length; ++i)
- {
- monitoredObjects[i].getLogger().removeAllAppenders();
- }
-
- appender.close();
-
- log.debug("Logging monitor stopped logging to " + filename);
- }
-
- // Private -------------------------------------------------------
-
- /**
- * Converts the specified XML DOM element to a monitored MBean.
- *
- * @param element the XML DOM element to be converted.
- * @return a monitored MBean represented by the specified XML DOM element.
- * @throws MalformedObjectNameException if the specified XML DOM element
- * does not contain a valid object
- * name.
- */
- private MonitoredMBean toMonitoredMBean(Element element) throws MalformedObjectNameException
- {
- String objectName = element.getAttribute(MBEAN_NAME_ATTRIBUTE);
-
- if ("".equals(objectName))
- {
- throw createAttributeNotFoundException(MBEAN_NAME_ATTRIBUTE);
- }
-
- String loggerName = element.getAttribute(MBEAN_LOGGER_ATTRIBUTE);
- if ("".equals(loggerName))
- {
- throw createAttributeNotFoundException(MBEAN_LOGGER_ATTRIBUTE);
- }
-
- Logger logger = Logger.getLogger(loggerName.toLowerCase());
- logger.setAdditivity(false);
- logger.setLevel(Level.INFO);
-
- String[] attributes = getMonitoredAttributes(element);
-
- return new MonitoredMBean(objectName, attributes, logger);
- }
-
- /**
- * Retrieves the attributes of the MBean to monitor.
- *
- * @param monitoredMBean a MBean, represented as a XML DOM element, for
- * which to retrieve the attributes to monitor.
- * @return the attributes of the MBean to monitor.
- */
- private String[] getMonitoredAttributes(Element monitoredMBean)
- {
- NodeList monitoredAttributes = monitoredMBean.getElementsByTagName(MBEAN_ATTRIBUTE_ELEMENT);
-
- int monitoredAttributesCount = monitoredAttributes.getLength();
- if (monitoredAttributesCount < 1)
- {
- throw createMissingElementException(MBEAN_ATTRIBUTE_ELEMENT);
- }
-
- String[] attributes = new String[monitoredAttributesCount];
- for (int i = 0; i < monitoredAttributesCount; ++i)
- {
- Node node = monitoredAttributes.item(i);
- Node attribute = node.getFirstChild();
-
- if (attribute.getNodeType() != Node.TEXT_NODE)
- {
- throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
- "Unexpected node type inside <attribute> for monitored MBean.");
- }
- attributes[i] = (((Text) attribute).getData()).trim();
- }
- return attributes;
- }
-
- /**
- * Creates a <code>DOMException</code> relating that at least one occurrence
- * of the specified element was not found as expected.
- *
- * @param element the expected element.
- * @return a <code>DOMException</code> relating that at least one occurrence
- * of the specified element was not found as expected.
- */
- private DOMException createMissingElementException(String element)
- {
- return new DOMException(DOMException.NOT_FOUND_ERR,
- "At least one <" + element + "> element is expected");
- }
-
- /**
- * Creates a <code>DOMException</code> relating that the specified attribute
- * was not found as expected.
- *
- * @param attribute the expected attribute.
- * @return a <code>DOMException</code> relating that the specified attribute
- * was not found as expected.
- */
- private DOMException createAttributeNotFoundException(String attribute)
- {
- return new DOMException(DOMException.NOT_FOUND_ERR,
- "Missing expected '" + attribute + "' attribute of a <monitoredmbean> element");
- }
-
-}
Deleted: trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitorMBean.java
===================================================================
--- trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitorMBean.java 2010-04-05 19:24:49 UTC (rev 103538)
+++ trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitorMBean.java 2010-04-05 21:38:47 UTC (rev 103539)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.services.loggingmonitor;
-
-import javax.management.MalformedObjectNameException;
-
-import org.jboss.system.ServiceMBean;
-import org.w3c.dom.Element;
-
-/**
- * This is the management interface of the LoggingMonitor service which provides
- * the ability to create monitoring logs for various MBeans and their
- * attributes.
- *
- * @author <a href="mailto:jimmy.wilson at acxiom.com">James Wilson</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public interface LoggingMonitorMBean extends ServiceMBean
-{
- /**
- * The name of the file to which this monitor's information
- * will be logged.
- */
- void setFilename(String filename);
- String getFilename();
-
- /**
- * Flag to indicate whether or not this monitor's log file should have
- * information appended to it, if it already exists. (default is true)
- */
- void setAppendToFile(boolean appendToFile);
- boolean getAppendToFile();
-
- /**
- * This monitor's log file rollover period. Valid values are
- * MONTH, WEEK, DAY, HALFDAY, HOUR, and MINUTE (case insensitive).
- * (default is DAY)
- */
- void setRolloverPeriod(String rolloverPeriod);
- String getRolloverPeriod();
-
- /**
- * The period to delay between monitoring snapshots.
- * (non-zero positive value)
- */
- void setMonitorPeriod(long monitorPeriod);
- long getMonitorPeriod();
-
- /**
- * The PatternLayout for logging entries
- * (default is "%d %-5p [%c] %m%n")
- */
- void setPatternLayout(String patternLayout);
- String getPatternLayout();
-
- /**
- * This monitor's log file rollover format as determined by the
- * <code>RolloverPeriod</code> attribute.
- */
- String getRolloverFormat();
-
- /**
- * Sets the monitored objects configuration.
- *
- * @param monitoredObjects the objects to be monitored specified in the
- * following format:
- * <pre>
- * <attribute name="MonitoredObjects">
- * <configuration>
- * <monitoredmbean name="[object name]" logger="[logger name]">
- * <attribute>[attribute name]</attribute>
- * <attribute>[attribute name]</attribute>
- * ...
- * </monitoredmbean>
- * </configuration>
- * </attribute>
- * </pre>
- *
- * @throws MalformedObjectNameException if the monitored objects
- * configuration contains an invalid
- * object name.
- */
- void setMonitoredObjects(Element monitoredObjects) throws MalformedObjectNameException;
-
-}
Deleted: trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitorTimerTask.java
===================================================================
--- trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitorTimerTask.java 2010-04-05 19:24:49 UTC (rev 103538)
+++ trunk/varia/src/main/java/org/jboss/services/loggingmonitor/LoggingMonitorTimerTask.java 2010-04-05 21:38:47 UTC (rev 103539)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.services.loggingmonitor;
-
-import java.util.TimerTask;
-
-import org.jboss.logging.Logger;
-
-
-/**
- * This class provides a repeatable task for monitoring to be
- * executed by a timer.
- *
- * @author <a href="mailto:jimmy.wilson at acxiom.com">James Wilson</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-class LoggingMonitorTimerTask extends TimerTask
-{
- private MonitoredMBean[] monitoredObjects;
- private Logger logger;
-
- /**
- * Constructor.
- *
- * @param monitoredObjects the objects to be monitored.
- * @param logger the logger to use for logging errors
- */
- public LoggingMonitorTimerTask(MonitoredMBean[] monitoredObjects, Logger logger)
- {
- this.monitoredObjects = monitoredObjects;
- this.logger = logger;
-
- for (int i = 0; i < monitoredObjects.length; ++i)
- {
- // log the header message
- monitoredObjects[i].logFormat();
- }
- }
-
- /**
- * TimerTask implementation.
- */
- public void run()
- {
- for (int i = 0; i < monitoredObjects.length; ++i)
- {
- try
- {
- monitoredObjects[i].logAttributes();
- }
- catch (Exception e)
- {
- logger.warn("Unable to log attributes for mbean: " + monitoredObjects[i].getObjectName(), e);
- }
- }
- }
-}
Deleted: trunk/varia/src/main/java/org/jboss/services/loggingmonitor/MonitoredMBean.java
===================================================================
--- trunk/varia/src/main/java/org/jboss/services/loggingmonitor/MonitoredMBean.java 2010-04-05 19:24:49 UTC (rev 103538)
+++ trunk/varia/src/main/java/org/jboss/services/loggingmonitor/MonitoredMBean.java 2010-04-05 21:38:47 UTC (rev 103539)
@@ -1,157 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.services.loggingmonitor;
-
-import javax.management.JMException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.apache.log4j.Logger;
-import org.jboss.mx.util.JMXExceptionDecoder;
-import org.jboss.mx.util.MBeanServerLocator;
-
-/**
- * This class encapsulates the information necessary for monitoring an MBean.
- *
- * @author <a href="mailto:jimmy.wilson at acxiom.com">James Wilson</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-class MonitoredMBean
-{
- private MBeanServer mbeanServer;
- private ObjectName objectName;
- private String[] attributes;
- private Logger logger; //apache logger
-
- /**
- * Constructor.
- *
- * @param objectName this monitored MBean's object name.
- * @param attributes the attributes of this MBean to monitor.
- * @param logger the logger for this monitored MBean.
- * @param throws MalformedObjectNameException if the specified object name
- * is invalid.
- */
- public MonitoredMBean(String objectName, String[] attributes, Logger logger) throws MalformedObjectNameException
- {
- this.objectName = new ObjectName(objectName);
- this.attributes = attributes;
- this.logger = logger;
- this.mbeanServer = MBeanServerLocator.locateJBoss();
- }
-
- /**
- * Retrieves the object name of this monitored MBean.
- *
- * @return this monitored MBean's object name.
- */
- public ObjectName getObjectName()
- {
- return objectName;
- }
-
- /**
- * Retrieves the attributes of this monitored MBean.
- *
- * @return this monitored MBean's attributes.
- */
- public String[] getAttributes()
- {
- return attributes;
- }
-
- /**
- * Retrieves the logger for this monitored MBean.
- *
- * @return this monitored MBean's logger.
- */
- public Logger getLogger()
- {
- return logger;
- }
-
- /**
- * Logs the format message for this monitored MBean.
- */
- public void logFormat()
- {
- logger.info(buildFormatMessage());
- }
-
- /**
- * Logs the attributes of this MBean that are being monitored.
- *
- * @throws JMException if the retrieval of a MBean attribute causes such an
- * exception.
- */
- public void logAttributes() throws Exception
- {
- try
- {
- StringBuffer message = new StringBuffer();
-
- for (int j = 0; j < attributes.length; ++j)
- {
- Object attributeValue = mbeanServer.getAttribute(objectName, attributes[j]);
-
- message.append(attributeValue);
-
- if (j < (attributes.length - 1))
- {
- message.append(",");
- }
- }
-
- logger.info(message);
- }
- catch (Exception e)
- {
- JMXExceptionDecoder.rethrow(e);
- }
- }
-
- /**
- * Builds the format message for this monitored MBean.
- *
- * @return this monitored MBean's format message.
- */
- private String buildFormatMessage()
- {
- StringBuffer message = new StringBuffer(objectName.toString());
- message.append(" monitor format: (");
-
- for (int i = 0; i < attributes.length; ++i)
- {
- message.append(attributes[i]);
-
- if (i < (attributes.length - 1))
- {
- message.append(',');
- }
- }
- message.append(")");
-
- return message.toString();
- }
-}
Deleted: trunk/varia/src/main/java/org/jboss/services/loggingmonitor/RolloverPeriod.java
===================================================================
--- trunk/varia/src/main/java/org/jboss/services/loggingmonitor/RolloverPeriod.java 2010-04-05 19:24:49 UTC (rev 103538)
+++ trunk/varia/src/main/java/org/jboss/services/loggingmonitor/RolloverPeriod.java 2010-04-05 21:38:47 UTC (rev 103539)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.services.loggingmonitor;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * This class encapsulates the specification of a log file's rollover period.
- *
- * @author <a href="mailto:jimmy.wilson at acxiom.com">James Wilson</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-class RolloverPeriod
-{
- private static final Map periodFormatsMap;
- static
- {
- periodFormatsMap = new HashMap();
- periodFormatsMap.put("MONTH", "\'.\'yyyy-MM");
- periodFormatsMap.put("MONTHLY", "\'.\'yyyy-MM");
- periodFormatsMap.put("WEEK", "\'.\'yyyy-ww");
- periodFormatsMap.put("WEEKLY", "\'.\'yyyy-ww");
- periodFormatsMap.put("DAY", "\'.\'yyyy-MM-dd");
- periodFormatsMap.put("DAILY", "\'.\'yyyy-MM-dd");
- periodFormatsMap.put("HALFDAY", "\'.\'yyyy-MM-dd-a");
- periodFormatsMap.put("HALFDAILY", "\'.\'yyyy-MM-dd-a");
- periodFormatsMap.put("HOUR", "\'.\'yyyy-MM-dd-HH");
- periodFormatsMap.put("HOURLY", "\'.\'yyyy-MM-dd-HH");
- periodFormatsMap.put("MINUTE", "\'.\'yyyy-MM-dd-HH-mm");
- }
-
- private String rolloverPeriod;
- private String rolloverFormat;
-
- /**
- * Constructor.
- *
- * @param rolloverPeriod a rollover period specification.
- */
- public RolloverPeriod(String rolloverPeriod)
- {
- this.rolloverFormat = (String)periodFormatsMap.get(rolloverPeriod.toUpperCase());
-
- if (this.rolloverFormat == null)
- {
- throw new IllegalArgumentException("Unknown rollover period: " + rolloverPeriod);
- }
- this.rolloverPeriod = rolloverPeriod;
- }
-
- /**
- * Returns the rollover format specification associated with the rollover
- * period specification used to construct this class.
- */
- public String getRolloverFormat()
- {
- return rolloverFormat;
- }
-
- /**
- * Returns the rollover period specification used to construct this class.
- */
- public String toString()
- {
- return rolloverPeriod;
- }
-}
Deleted: trunk/varia/src/resources/services/loggingmonitor/deploy/default-ds-monitor-service.xml
===================================================================
--- trunk/varia/src/resources/services/loggingmonitor/deploy/default-ds-monitor-service.xml 2010-04-05 19:24:49 UTC (rev 103538)
+++ trunk/varia/src/resources/services/loggingmonitor/deploy/default-ds-monitor-service.xml 2010-04-05 21:38:47 UTC (rev 103539)
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE server PUBLIC
- "-//JBoss//DTD MBean Service 4.0//EN"
- "http://www.jboss.org/j2ee/dtd/jboss-service_4_0.dtd">
-
-<!-- $Id$ -->
-
-<!--============================================================================
- | DefaultDS LoggingMonitor Service Configuration
- |
- | An example configuration of the LoggingMonitor service to monitor the JBoss
- | default datasource.
- |===========================================================================-->
-<server>
-
- <mbean code="org.jboss.services.loggingmonitor.LoggingMonitor"
- name="jboss.monitor:type=LoggingMonitor,name=DefaultDSMonitor">
-
- <!--
- | The name of the file to which monitoring information will be logged.
- -->
- <attribute name="Filename">${jboss.server.log.dir}/default-ds.log</attribute>
-
- <!--
- | Whether or not this monitor's log file should have information appended
- | to it, if it already exists. This attribute is *not* required, and the
- | default value is true.
- -->
- <attribute name="AppendToFile">false</attribute>
-
- <!--
- | Controls the org.apache.log4j.PatternLayout for logging entries.
- | The default pattern is "%d %-5p [%c] %m%n".
- <attribute name="PatternLayout">%d %-5p [%c] %m%n</attribute>
- -->
-
- <!--
- | The rollover period for this monitor's log file. Valid values are
- | MONTH, WEEK, DAY, HALFDAY, HOUR, MINUTE (case insensitive). This
- | attributes is *not* required, and the default value is DAY.
- -->
- <attribute name="RolloverPeriod">DAY</attribute>
-
- <!--
- | The period to delay in between monitoring snapshots (in milliseconds).
- -->
- <attribute name="MonitorPeriod">5000</attribute>
-
- <!--
- | The list of objects (MBeans) and their corresponding attributes to be
- | monitored.
- |
- | This parameter is specified as a XML fragment as follows:
- |
- | <attribute name="MonitoredObjects">
- | <configuration>
- | <monitoredmbean name="[object name]"
- | logger="[logger name]">
- | <attribute>[an attribute name]</attribute>
- | <attribute>[an attribute name]</attribute>
- | ...
- | </monitoredmbean>
- | </configuration>
- | </attribute>
- -->
- <attribute name="MonitoredObjects">
- <configuration>
- <monitoredmbean name="jboss.jca:name=DefaultDS,service=ManagedConnectionPool"
- logger="jca.defaultds">
- <attribute>InUseConnectionCount</attribute>
- <attribute>AvailableConnectionCount</attribute>
- <attribute>ConnectionCreatedCount</attribute>
- <attribute>ConnectionDestroyedCount</attribute>
- <attribute>MaxConnectionsInUseCount</attribute>
- </monitoredmbean>
- </configuration>
- </attribute>
-
- <depends>jboss.jca:name=DefaultDS,service=ManagedConnectionPool</depends>
- </mbean>
-
-</server>
Deleted: trunk/varia/src/resources/services/loggingmonitor/deploy/jvm-monitor-service.xml
===================================================================
--- trunk/varia/src/resources/services/loggingmonitor/deploy/jvm-monitor-service.xml 2010-04-05 19:24:49 UTC (rev 103538)
+++ trunk/varia/src/resources/services/loggingmonitor/deploy/jvm-monitor-service.xml 2010-04-05 21:38:47 UTC (rev 103539)
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE server PUBLIC
- "-//JBoss//DTD MBean Service 4.0//EN"
- "http://www.jboss.org/j2ee/dtd/jboss-service_4_0.dtd">
-
-<!-- $Id$ -->
-
-<!--============================================================================
- | JVM LoggingMonitor Service Configuration
- |
- | An example configuration of the LoggingMonitor service to monitor JVM thread
- | and heap useage information.
- |===========================================================================-->
-<server>
-
- <mbean code="org.jboss.services.loggingmonitor.LoggingMonitor"
- name="jboss.monitor:type=LoggingMonitor,name=JVMMonitor">
-
- <!--
- | The name of the file to which monitoring information will be logged.
- -->
- <attribute name="Filename">${jboss.server.log.dir}/jvm.log</attribute>
-
- <!--
- | Whether or not this monitor's log file should have information appended
- | to it, if it already exists. This attribute is *not* required, and the
- | default value is true.
- -->
- <attribute name="AppendToFile">false</attribute>
-
- <!--
- | Controls the org.apache.log4j.PatternLayout for logging entries.
- | The default pattern is "%d %-5p [%c] %m%n".
- <attribute name="PatternLayout">%d %-5p [%c] %m%n</attribute>
- -->
-
- <!--
- | The rollover period for this monitor's log file. Valid values are
- | MONTH, WEEK, DAY, HALFDAY, HOUR, MINUTE (case insensitive). This
- | attributes is *not* required, and the default value is DAY.
- -->
- <attribute name="RolloverPeriod">DAY</attribute>
-
- <!--
- | The period to delay in between monitoring snapshots (in milliseconds).
- -->
- <attribute name="MonitorPeriod">10000</attribute>
-
- <!--
- | The list of objects (MBeans) and their corresponding attributes to be
- | monitored.
- |
- | This parameter is specified as a XML fragment as follows:
- |
- | <attribute name="MonitoredObjects">
- | <configuration>
- | <monitoredmbean name="[object name]"
- | logger="[logger name]">
- | <attribute>[an attribute name]</attribute>
- | <attribute>[an attribute name]</attribute>
- | ...
- | </monitoredmbean>
- | </configuration>
- | </attribute>
- -->
- <attribute name="MonitoredObjects">
- <configuration>
- <monitoredmbean name="jboss.system:type=ServerInfo" logger="jvm.threads">
- <attribute>ActiveThreadCount</attribute>
- </monitoredmbean>
- <monitoredmbean name="jboss.system:type=ServerInfo" logger="jvm.heap">
- <attribute>FreeMemory</attribute>
- <attribute>TotalMemory</attribute>
- <attribute>MaxMemory</attribute>
- </monitoredmbean>
- </configuration>
- </attribute>
-
- <!--
- | Since this logging monitor only depends upon the ServerInfo MBean, a
- | non-service MBean, no dependancies can be specified.
- -->
- <!-- <depends>jboss.system:type=ServerInfo</depends> -->
- </mbean>
-
-</server>
More information about the jboss-cvs-commits
mailing list