Update: LoggingMonitor service has been incorporated to JBoss v4.0.3 !
The LoggingMonitor service was considered to be quite useful and well writen,
so it is now offered as part of the standard jboss distribution, starting from
JBoss v4.0.3.
The service can be found at ./docs/examples/jmx/logging-monitor. Look for
a readme.txt file with instructions, but it all boils down to copying
./docs/examples/jmx/logging-monitor/lib/logging-monitor.jar to your server
lib directory, then deploy one or more -service.xml descriptors to start
logging away.
There are a couple of useful monitor service descriptors to get you started
at ./docs/examples/jmx/logging-monitor/deploy.
The major difference with the standalone version is the change in the package
name. The service can be found at: org.jboss.services.loggingmonitor.LoggingMonitor. The related JIRA task
can be found here.
This is all, kudos to James Wilson.
Cheers
dimitris@jboss
-
Requirements
JBoss 3.2.x/4.x
JDK 1.3 (not tested)/1.4/5.0
Introduction
The JBoss LoggingMonitor service is similar in purpose to the other monitoring services provided as a part of JBossAS in the org.jboss.monitor package. The JBoss LoggingMonitor service monitor's the specified attributes of a MBean periodically and logs their value to the filename specified. This file can then be used for debugging and/or charting JBoss services information based upon your specific use case(s).
Source/Binary Download
The source/binary distribution is attached to this wiki page and can be downloaded based on revision history below.
Revision History
loggingmonitor.zip The first/initial release.
loggingmonitor1_1.zip: Added functionality to allow configuration of the monitor's log file rollover period.
Corrected README to indicate (correctly) that multiple MBeans can be monitored in a single monitor deployment.
Added
RolloverPeriod
attribute to the README, examples, and Wiki.
Synchronized this wiki-based release with that which is provided as a part of JBoss 4.0.3sp1 so that futher development could continue without forking (and 3.2.x users could use it too).
Changed the build to produce a file named logging-monitor.jar (instead of loggingmonitor.jar) in order to conform to the JBoss 4.0.3sp1 readme.txt file
Renamed the conf subdirectory in the release to deploy to conform to the JBoss 4.0.3sp1 readme.txt file
Removed the dist subdirectory in the release (the build now places its files in the lib subdirectory) to conform to the JBoss 4.0.3sp1 readme.txt file
Removed non-existent reference to ${test-classes} in the build.xml "clean" target
Shortened build.xml target names (and references to them) to be more sensible
Build
The download comes with a precompiled version of JBoss LoggingMonitor. To build it on your own, use the provided build.xml Ant project file to build the JBoss LoggingMonitor service. The default target will build the required logging-monitor.jar. There is an additional target for Javadoc generation as well.
Installation/Use
Place the lib/logging-monitor.jar file in the lib directory of your JBoss server configuration, and write your customized -service.xml file to your server configuration's deploy directory. Multiple -service.xml files can be deployed simultaneously utilizing this MBean. Examples of various -service.xml files can be found in the deploy subdirectory of the source/binary download.
Service XML File Format
The JBoss LoggingMonitor service MBean's configuration file format is the same as most JBoss MBean services. Its DTD is specified here.
The following is a description of the attributes that can be specified:
Filename
The name of the file to which monitoring information will be logged. This attribute can not be set to null or be empty.
AppendToFile
Whether or not a 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.
PatternLayout
Controls the org.apache.log4j.PatternLayout for logging entries. This attribute is not required, and the default value is
%d %-5p [%c] %m%n
.
RolloverPeriod
The rollover period for the monitor's log file. Valid values are MONTH, WEEK, DAY, HALFDAY, HOUR, and MINUTE (case insensitive). This attribute is not required, and the default value is DAY.
MonitoredObjects
The list of MBeans and their corresponding attributes to be monitored. This parameter is specified as a XML fragment as follows:
<configuration> <monitoredmbean name="[object name]" logger="[logger name]"> <attribute>[attribute name]</attribute> <attribute>[attribute name]</attribute> ... </monitoredmbean> ... </configuration>
Where:
As the XML fragment indicates, any number of MBeans can be monitored, and any number of attributes for a given MBean can be specified. An example XML service configuration for monitoring JVM thread/heap information is available here, and an example XML service configuration for monitoring the JBoss default datasource is available here.
MonitorPeriod
The frequency with which to log information (in milliseconds). This attribute must have a non-zero, positive value.
Questions
Questions regarding the use of the JBoss LoggingMonitor service should be directed to the Management, JMX/JBoss user forum.
Comments