|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfreemarker.ext.misc.Log4jExceptionListener
public final class Log4jExceptionListener
Adapts FM-Classic's exception events to Log4j's logging methods. This code is known to work with Log4j version 1.1.3, but should be compatible with earlier versions as well.
Log4j can be found at the Jakarta Apache web site.
Usage example:
// Configure Log4j Category rootCategory = Category.getRoot(); PatternLayout patternLayout = new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN); ConsoleAppender consoleAppender = new ConsoleAppender(patternLayout, "System.err"); rootCategory.addAppender(consoleAppender); // Set up the template Template template = new Template(filename); // Set up the model TemplateModelRoot modelRoot = (...) // Set up the listener SimpleEventAdapter adapter = new SimpleEventAdapter( new Log4jExceptionListener() ); // Call the template template.process( modelRoot, writer, adapter );
Constructor Summary | |
---|---|
Log4jExceptionListener()
Creates new Log4jExceptionListener |
Method Summary | |
---|---|
void |
exceptionThrown(TemplateExceptionEvent e)
Passes exceptions raised by FreeMarker onto Log4j. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Log4jExceptionListener()
Method Detail |
---|
public void exceptionThrown(TemplateExceptionEvent e)
exceptionThrown
in interface TemplateExceptionListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |