Logging

FreeMarker integrates with the following logging packages: Log4J, Avalon LogKit, and java.util.logging (Java2 platform 1.4 and above). You need not do anything in order for FreeMarker to use these loggers; if any of them is discovered through the class loader that loaded FreeMarker classes, it is used automatically. All log messages produced by FreeMarker are logged into the logger hierarchy whose top-level logger is named freemarker. Currently used loggers are:

Logger name Purpose
freemarker.beans Logs messages of the Beans wrapper module.
freemarker.cache Logs messages related to template loading and caching.
freemarker.runtime Logs template exceptions thrown during template processing.
freemarker.servlet Logs messages of the FreemarkerServlet class.

FreeMarker will look for the logging packages in this order, and will use the first package it finds: Log4J, Avalon, java.util.logging. However, if you call the static selectLoggerLibrary method on the freemarker.log.Logger class with appropriate parameter, you can explicitly select a logger package, or even disable the logging.

You can also call the static selectLoggerLibrary method on the freemarker.log.Logger class and pass it a string that will be used to prefix the above mentioned logger names. This is useful if you want to have separate loggers on a per-application basis.


Page generated: 2007-12-05 00:36:54 GMT FreeMarker Manual -- For FreeMarker 2.3.11