@ThreadSafe public class LoggingExceptionCallback extends Object implements IExceptionCallback<Throwable>, IHasErrorLevel
IExceptionCallback interface, that
logs all exceptions to a standard logger.| Constructor and Description |
|---|
LoggingExceptionCallback() |
| Modifier and Type | Method and Description |
|---|---|
IErrorLevel |
getErrorLevel() |
protected String |
getLogMessage(Throwable t)
Get the text to be logged for a certain exception
|
protected boolean |
isLogException(Throwable t)
Check if the passed exception should be part of the log entry.
|
void |
onException(Throwable t)
Called when an exception of the specified type occurred.
|
LoggingExceptionCallback |
setErrorLevel(IErrorLevel aErrorLevel)
Set the error level to be used.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waithasErrorLevel, isError, isFailure, isNoError, isSuccessand, or@Nonnull public IErrorLevel getErrorLevel()
getErrorLevel in interface IHasErrorLevelnull.@Nonnull public final LoggingExceptionCallback setErrorLevel(@Nonnull IErrorLevel aErrorLevel)
aErrorLevel - Error level to use. May not be null.@Nonnull @Nonempty @OverrideOnDemand protected String getLogMessage(@Nullable Throwable t)
t - The exception to be logged. May theoretically be null.null nor empty.@OverrideOnDemand protected boolean isLogException(@Nullable Throwable t)
t - The exception to check. May theoretically be null.true to log the exception, false to not
log itpublic void onException(@Nullable Throwable t)
IExceptionCallbackonException in interface IExceptionCallback<Throwable>t - The exception. Never null.Copyright © 2014–2020 Philip Helger. All rights reserved.