public class LoggingErrorHandlerFactory extends 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(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,
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.
|
private static final org.slf4j.Logger log
private LoggingErrorHandlerFactory.Level level
private boolean rememberLast
public LoggingErrorHandlerFactory()
public LoggingErrorHandlerFactory(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, 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