XML Calabash 0.9.15

Volume 12, Issue 34; 05 Oct 2009; last modified 08 Oct 2010

A new release at last. New features, fewer bugs, and test suite clean again.

Speaking of work (letting the non sequitors pile up), when I wasn't on the beach, I was hacking XML Calabash. I always update the project status page, but in case that's too subtle, perhaps this essay will catch your attention. (You're reading this, so I guess that should be “caught” without the “perhaps”, but nevermind.)

Next in the task queue: supporting Saxon 9.2. I fear this is going to be a bit of a b*tch as I reach down into the guts of Saxon in a few places. Fair warning: I don't plan to attempt to support previous versions of Saxon after I make this switch.

XML Calabash Logging

One of the changes in 0.9.15 is the switch from my own crufty, home grown logging infrastructure to the Java core logging facilities. On the plus side: this gives you a lot more control over the logging. On the minus: you have to deal with the core logging facilities.

Near as I can tell, this has to be done with a properties file. Here's what I do: I set the system property java.util.logging.config.file to point to my own logging configuration file, /Users/ndw/java/logging.properties.

My logging properties file, constructed mostly through trial and error, is shown below. The important bits are:

 

There are two places to control the amount of detail in the logs. By default, the console handler won't print any messages more detailed than “INFO”. If you want to get more detail, you have to turn this knob appropriately.

 

I really dislike the default message format, so I wrote a formatter that produces slightly more compact output. You might like it too.

 

This is the other place where you can control the amount of detail. “ALL” gives you all the messages. You might prefer “SEVERE”, which gives you only the fatal errors.

You can be selective here. If, for some reason, you want to see the gory detail of the XInclude step, but ignore everything else, you could set:

com.xmlcalabash.level=SEVERE
com.xmlcalabash.XInclude=FINEST

I'll try to provide better documentation for the available names.

Here's my current logging properties file:

############################################################
# Logging Configuration File
#
# You can use a different file by specifying a filename
# with the java.util.logging.config.file system property.  
# For example java -Djava.util.logging.config.file=myfile
############################################################

############################################################
#  	Global properties
############################################################

# "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

# 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 = ALL

############################################################
# 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=FINE
java.util.logging.ConsoleHandler.formatter=com.xmlcalabash.util.LogFormatter

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

com.xmlcalabash.level=ALL

I'm fully open to suggestions for better approaches.