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
-
JBoss 3.2.x/4.x
JDK 1.3 (not tested)/1.4/5.0
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).
The source/binary distribution is attached to this wiki page and can be downloaded based on revision history below.
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
RolloverPeriodattribute 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
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.
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.
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:
FilenameThe name of the file to which monitoring information will be logged. This attribute can not be set to null or be empty.
AppendToFileWhether 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.
PatternLayoutControls the org.apache.log4j.PatternLayout for logging entries. This attribute is not required, and the default value is
%d %-5p [%c] %m%n.
RolloverPeriodThe 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.
MonitoredObjectsThe 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:
bject name is the name of the MBean to be monitored.
ogger name is the name of the logger to be used when logging attribute information.
ttribute name is the name of an attribute to be logged.
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.
MonitorPeriodThe frequency with which to log information (in milliseconds). This attribute must have a non-zero, positive value.
Questions regarding the use of the JBoss LoggingMonitor service should be directed to the Management, JMX/JBoss user forum.
There are no comments on this article