Module ringo/logging

This module provides generic logging support for Ringo applications. It uses SLF4J or Apache log4j if either is detected in the classpath, and will fall back to java.util.logging otherwise.

If the first argument passed to any of the logging methods is a string containing any number of curly bracket pairs ({}), the logger will interpret it as format string and use any following arguments to replace the curly bracket pairs. If an argument is an Error or Java Exception object, the logger will render a stack trace for it and append it to the log message.


Logger (name, impl)

Logger class. This constructor is not exported, use this module's {@link getLogger} to get a logger instance.

Parameters

name the Logger name
impl the logger implementation

See


Logger.prototype.debug ()


Logger.prototype.error ()


Logger.prototype.info ()


Logger.prototype.isDebugEnabled ()


Logger.prototype.isErrorEnabled ()


Logger.prototype.isInfoEnabled ()


Logger.prototype.isTraceEnabled ()


Logger.prototype.isWarnEnabled ()


Logger.prototype.trace ()


Logger.prototype.warn ()


getInterceptor ()

Return the log message interceptor for the current thread, or null if none is set.

Returns

the interceptor array

getLogger (name)

Get a logger for the given name.

Parameters

string name the name of the logger

Returns

Logger a logger instance for the given name

setConfig (resource, watchForUpdates)

Configure log4j using the given file resource.

If you plan to update the configuration make sure to set the reset property to true in your configuration file.

Parameters

Resource resource the configuration resource in XML or properties format
Boolean watchForUpdates if true a scheduler thread is started that repeatedly checks the resource for updates.

setInterceptor (array)

Use array as log message interceptor for the current thread.

Parameters

array an array