helma.logging
The helma.logging module provides logging functionality using Apache log4j.
helma.logging can be configured by passing a log4j XML or properties configuration file to the setConfig() method. The default configuration is file modules/helma/log4j.properties.
Helma provides a special Appender class called org.helma.util.RhinoAppender that allows to send log messages to a Javascript callback function. The logging module provides the methods enableResponseLog() and disableResponseLog() to enable and disable appending of RhinoAppender log messages to a response buffer, using similar formatting as res.debug in Helma 1.
importModule('helma.logging', 'logging');
logging.enableResponseLog();
var log = logging.getLogger('modulename');
Then the following code ...
log.info("Hello world!");
try {
foo.bar;
} catch (e) {
log.error(e, e.rhinoException);
}
... will produce the following output on the rendered page:
3300 [pool-1-thread-2] INFO modulename - Hello world!
3303 [pool-1-thread-2] ERROR modulename - ReferenceError: "foo" is not defined.