XmlBlaster Logo

REQUIREMENT

admin.logging

XmlBlaster Logo


Type NEW
Priority HIGH
Status CLOSED
Topic XmlBlaster uses the JDK 1.4 logging framework
Des
cription

All logging output from xmlBlaster is done with the JDK 1.4 logging framework. This was introduced to xmlBlaster version 1.1.2, replacing the outdated jutils logging framework. Our configuration file is xmlBlaster/config/logging.properties.

We provide two xmlBlaster specific components to adjust the logging to our needs.

The first is an own formatter called org.xmlBlaster.util.log.XbFormatter, using this in logging.properties prints colorful logging messages to your Unix/Linux console, errors are marked red to be easy spotted.

The other extension is a log event listener called org.xmlBlaster.util.log.XbNotifyHandler. You should not remove it, it is needed for our EventPlugin to receive logging events about log.severe and log.warning occurrences. For details consult the admin.events requirement.

The logging.properties file can be set on command line with

  java -Djava.util.logging.config.file=myLog.properties

Upgrading from jutils logging

If you have written your own plugins and are upgrading from xmlBlaster before 1.1.1, your plugins will not compile anymore as the org.jutils package is removed. You can manually change your logging code to java.utils.logging, or if you prefer, try our helper script
$XMLBLASTER_HOME/bin/convertJutilsToJavaLogging.sh MyPlugin.java.
It will do its best to convert your java code. Just keep a backup of your java files in case the script does not do what you expect it to do.

Note that the old command line settings to change the logging level are not supported anymore:

 # Is NOT supported anymore:
 java org.xmlBlaster.Main -trace[core] true -dump true

The new command line syntax is shown in the example section below.

Example
Java

Command line configuration

It is possible to set all logging levels on command line, those settings have precedence over the settings in logging.properties, here are some examples:

Dump all calls into the core and dumps all SOCKET or email protocol messages:
java org.xmlBlaster.Main -logging/org.xmlBlaster.engine.RequestBroker FINE -logging/org.xmlBlaster.util.protocol FINEST

Switches on logging but limits the output of the engine package to logging level INFO (except RequestBroker), additionally we choose explicitly the logging configuration file and add JMX for observation with jconsole:
java -Djava.util.logging.config.file=$XMLBLASTER_HOME/config/logging.properties -Dcom.sun.management.jmxremote org.xmlBlaster.Main -logging FINE -logging/org.xmlBlaster.engine INFO -logging/org.xmlBlaster.engine.RequestBroker FINEST

Example
Java

Example of logging.properties

#-----------------------------------------------------------------------------
# Name:      xmlBlasterJdk14Logging.properties
# Project:   xmlBlaster.org
# Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
#
# Comment:   Configure JDK 1.4 java.util.logging output
#
# Levels:    FINEST  
#            FINER   
#            FINE    
#            INFO    
#            WARNING 
#            SEVERE  
#            CONFIG
#
# Force the logging property file:
#  java -Djava.util.logging.config.file=$XMLBLASTER_HOME/config/logging.properties ...
#
# Configure logging from command line:
#  -logging FINE
#  -/node/heron/logging FINE
#  -logging/org.xmlBlaster.engine FINE
#  -/node/heron/logging/org.xmlBlaster.engine FINE
#-----------------------------------------------------------------------------

# "handlers" specifies a comma separated list of log Handler
# classes.  These handlers will be installed during VM startup.
# Note that these classes must be on the system classpath.
# By default we only configure a ConsoleHandler, which will only
# show messages at the INFO and above levels.
handlers= java.util.logging.ConsoleHandler, org.xmlBlaster.util.log.XbNotifyHandler

# To also add the FileHandler, use the following line instead.
#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler

# Default global logging level.
# This specifies which kinds of events are logged across
# all loggers.  For any given facility this global level
# can be overriden by a facility specific level
# Note that the ConsoleHandler also has a separate level
# setting to limit messages printed to the console.
.level= INFO

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

# default file output is in user's home directory.
java.util.logging.FileHandler.pattern = %h/java%u.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter

# Limit the message that are printed on the console to INFO and above.
java.util.logging.ConsoleHandler.level = INFO
#java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.formatter = org.xmlBlaster.util.log.XbFormatter


############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

# For example, set the com.xyz.foo logger to only log SEVERE
org.xmlBlaster.engine.level = INFO
#org.xmlBlaster.engine.handlers=org.xmlBlaster.util.log.XbHandler
#org.xmlBlaster.engine.useParentHandlers=false
#org.xmlBlaster.engine.config=org.xmlBlaster.util.log.XbConfig
Configure

These parameters allow to configure the logging, other java.util.logging specific settings are supported as well, please consult the Java logging documentation.

Property Default / Example Description Impl
xmlBlaster/java.util.logging true If set to 'false' there is no xmlBlaster specific handling. As a default xmlBlaster adds some additional control for loglevels on command line and some colorful logging on UNIX. yes
java.util.logging.config.file logging.properties This setting is the same used by the standard java logging framework. XmlBlaster additionally searches the logging.properties in its usual configuration lookup manner as described in requirement util.property. yes

NOTE: Configuration parameters are specified on command line (-someValue 17) or in the xmlBlaster.properties file (someValue=17). See requirement "util.property" for details.
Columns named Impl tells you if the feature is implemented.
Columns named Hot tells you if the configuration is changeable in hot operation.

See API Colorful formatting
See API Listener for SEVERE and WARNING events
See JDK 1.4 logging intro
See JDK 1.4 API

This page is generated from the requirement XML file xmlBlaster/doc/requirements/admin.logging.xml

Back to overview