<?xml version="1.0" encoding="UTF-8"?>
<essay xml:lang="en" version="5.0" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:gal="http://norman.walsh.name/rdf/gallery#" xmlns:foaf="http://xmlns.com/foaf/0.1/">
<info>
    
    
    
    
    
    
    
    
<title>XML Calabash 0.9.15</title><biblioid class="uri">http://norman.walsh.name/2009/10/05/xmlcalabash</biblioid>
<volumenum>12</volumenum>
<issuenum>34</issuenum>
<pubdate>2009-10-05T21:04:11-04:00</pubdate>
<author>
      <personname>
<firstname>Norman</firstname>
	<surname>Walsh</surname>
</personname>
    </author>
<copyright>
      <year>2009</year>
      <holder>Norman Walsh</holder>
    </copyright>
<abstract>
<para>A new release at last. New features, fewer bugs, and test suite
clean again.</para>
</abstract>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#Calabash"/>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#Java"/>
</info>

<para xml:id="p1">Speaking <link xlink:href="dominicanrepublic#p1">of work</link>
(letting the non sequitors pile up), when I wasn't on the beach, I
was hacking
<link xlink:href="http://xmlcalabash.com/">XML Calabash</link>.
I always
update the
<link xlink:href="/2008/projects/calabash">project status page</link>,
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.)</para>

<para xml:id="p2">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.</para>

<section xml:id="logging">
<title>XML Calabash Logging</title>

<para xml:id="p3">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.</para>

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

<para xml:id="p5">My logging properties file, constructed mostly through trial and
error, is shown below. The important bits are:</para>

<calloutlist>
<callout arearefs="conslevel">
<para xml:id="p6">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
“<literal>INFO</literal>”. If you want to get more detail, you have to turn
this knob appropriately.</para>
</callout>
<callout arearefs="consfmt">
<para xml:id="p7">I really dislike the default message format, so I wrote a formatter
that produces slightly more compact output. You might like it too.
</para>
</callout>
<callout arearefs="calabashlevel">
<para xml:id="p8">This is the other place where you can control the amount of detail.
“<literal>ALL</literal>” gives you all the messages. You might prefer
“<literal>SEVERE</literal>”, which gives you only the fatal errors.</para>
<para xml:id="p9">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:</para>
<programlisting>com.xmlcalabash.level=SEVERE
com.xmlcalabash.XInclude=FINEST</programlisting>
</callout>
</calloutlist>

<para xml:id="p10">I'll try to provide better documentation for the available names.</para>

<para xml:id="p11">Here's my current logging properties file:</para>

<programlisting>############################################################
# 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<co xml:id="conslevel"/>
java.util.logging.ConsoleHandler.formatter=com.xmlcalabash.util.LogFormatter<co xml:id="consfmt"/>

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

com.xmlcalabash.level=ALL<co xml:id="calabashlevel"/></programlisting>

<para xml:id="p12">I'm fully open to suggestions for better approaches.</para>

</section>
</essay>

