public class LoggingErrorHandlerFactory extends java.lang.Object implements ErrorHandlerFactory<Action>, ErrorHandler<Action>
Modifier and Type | Class and Description |
---|---|
static class |
LoggingErrorHandlerFactory.Level
Log level implementations for slf4j.
|
Modifier and Type | Field and Description |
---|---|
private LoggingErrorHandlerFactory.Level |
level |
private static org.slf4j.Logger |
log |
private boolean |
rememberLast |
Constructor and Description |
---|
LoggingErrorHandlerFactory()
Create a new error-level loggin error handler factory.
|
LoggingErrorHandlerFactory(java.lang.String level)
Create a new custom-level logging error handler factory.
|
Modifier and Type | Method and Description |
---|---|
ErrorHandler<Action> |
getErrorHandler(InvokationContext<? extends Action> context)
Get an error handler for the current context.
|
void |
handleError(InvokationContext<? extends Action> context,
Action action,
java.lang.String message,
java.lang.Throwable t)
Handle an exception that has happened.
|
void |
setLevel(java.lang.String level)
Set the level of the error handler.
|
void |
setRememberLast(java.lang.String remember)
Set a flag indicating if errors should be remembered
by the registry.
|
private static final org.slf4j.Logger log
private LoggingErrorHandlerFactory.Level level
private boolean rememberLast
public LoggingErrorHandlerFactory()
public LoggingErrorHandlerFactory(java.lang.String level)
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, java.lang.String message, java.lang.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(java.lang.String level)
public void setRememberLast(java.lang.String remember)
Registry.getLastExtensionError(String)
and/or
Registry.getLastExtensionPointError(String)
.remember
- A string that evaluates to a boolean