Logging

The debug version of Saxon-CE provides error and event logging capabilities with a configurable logging threshold. If a developer console is available in the host browser, this will be the logging output destination, otherwise, output is sent to a floating and resizable HTML panel contained within the web page.

The logging features described here are only supported by the debug version of Saxon-CE. They are designed for use when developing and testing the stylesheets to run under Saxon-CE. For the production version, logging features are 'compiled out' to reduce file size and improve performance. See the Installing section for more detail.

The threshold level for logging is controlled in three possible ways:

  1. from the URI in the browser address bar using the logLevel parameter - e.g. http://demoqx.com?logLevel=FINE.

  2. from the JavaScript API, by calling the Saxon object's setLogLevel function.

  3. from the JavaScript API, by setting the logLevel property of the Command object.

Setting the logLevel in the URI will override any logLevel set from JavaScript. The default logLevel is set to SEVERE. The levels used are summarized below:

Level

Description

OFF

All logging disabled

SEVERE(Default)

All fatal XSLT or internal errors

WARNING

Bad but not fatal conditions

INFO

Output from xsl:message and fn:trace()

CONFIG

Configuration data (Not yet used)

FINE

High-level XSLT calls: main transform, event transforms and result-documents

FINER

More granular loggable events

FINEST

Provides a trace output (in XML form) at the XSLT instruction level

Log events and errors may also be handled from JavaScript by setting an error handler function for the Saxon object (see setErrorHandler); this may be used for capturing results from automated tests, or for providing a custom view of loggable events or errors.

Depending on the browser, the logging output destination for logging may switch between the developer console and the floating HTML panel.

For example, with Internet Explorer 9, the floating logging panel will show when the web page is first loaded if no console is yet opened. To switch to using the developer console, press F12 and then select script > start debugging: this reloads the web page, but because the developer console is now detected, all logging will be directed there instead.

As you might expect, other browsers are different. For Chrome, Firefox/Firebug, Opera and Safari, the console always seems to be available for logging, even if not visible. You therefore won't see the floating log panel, but will instead just need to open the console to review log events.