|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.extensions.LoggingErrorHandlerFactory
public class LoggingErrorHandlerFactory
Exception handler factory implementation that logs error messages using the default logging mechanism. This factory is it's own error handler and the implementation is thread-safe (once the level has been set).
Field Summary | |
---|---|
private Level |
level
|
private static Logger |
log
|
private boolean |
rememberLast
|
Constructor Summary | |
---|---|
LoggingErrorHandlerFactory()
Create a new error-level loggin error handler factory. |
|
LoggingErrorHandlerFactory(String level)
Create a new custom-level logging error handler factory. |
Method Summary | |
---|---|
ErrorHandler<Action> |
getErrorHandler(InvokationContext<? extends Action> context)
Get an error handler for the current context. |
void |
handleError(InvokationContext<? extends Action> context,
Action action,
String message,
Throwable t)
Handle an exception that has happened. |
void |
setLevel(String level)
Set the level of the error handler. |
void |
setRememberLast(String remember)
Set a flag indicating if errors should be remembered by the registry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger log
private Level level
private boolean rememberLast
Constructor Detail |
---|
public LoggingErrorHandlerFactory()
public LoggingErrorHandlerFactory(String level)
Method Detail |
---|
public ErrorHandler<Action> getErrorHandler(InvokationContext<? extends Action> context)
ErrorHandlerFactory
getErrorHandler
in interface ErrorHandlerFactory<Action>
context
- The current invokation context which is an extension
point context (the InvokationContext.getExtension()
method
is expected to return null)public void handleError(InvokationContext<? extends Action> context, Action action, String message, Throwable t)
ErrorHandler
Note that there are three stages in the extension mechanism, which may cause some of the parameters to be null:
handleError
in interface ErrorHandler<Action>
context
- The extension context, which can be nullaction
- The action that was being rendered when the
error happened, which can be nullmessage
- An optional error messaget
- The errorpublic void setLevel(String level)
public void setRememberLast(String remember)
Registry.getLastExtensionError(String)
and/or
Registry.getLastExtensionPointError(String)
.
remember
- A string that evaluates to a boolean
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |