public class RecordingExceptionHandler extends Object implements ExceptionHandler
ExceptionKey.
The supplied exceptionKeyCountMap must be thread-safe - for
example a ConcurrentHashMap. The handler itself
is thread-safe.
The map may grow without bound if unique keys keep being added. Periodically evict infrequently used entries to control memory usage.
| Constructor and Description |
|---|
RecordingExceptionHandler(LogLevel level,
Map<ExceptionKey,Integer> exceptionKeyCountMap,
boolean exceptionsOnly)
Creates a handler that records exceptions in the supplied map.
|
| Modifier and Type | Method and Description |
|---|---|
void |
on(@NotNull Class<?> clazz,
@Nullable String message,
Throwable thrown)
Records an exception by incrementing the count of its corresponding ExceptionKey in the map.
|
void |
on(@NotNull org.slf4j.Logger logger,
@Nullable String message,
Throwable thrown)
Records an exception by incrementing the count of its corresponding ExceptionKey in the map.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdefaultHandler, ignoresEverything, isEnabled, on, on, onpublic RecordingExceptionHandler(LogLevel level, Map<ExceptionKey,Integer> exceptionKeyCountMap, boolean exceptionsOnly)
level - the LogLevel used in the ExceptionKey.exceptionKeyCountMap - thread-safe map where counts are stored, for example a
ConcurrentHashMap.exceptionsOnly - when true, only errors with a Throwable
are recorded.public void on(@NotNull
@NotNull Class<?> clazz,
@Nullable
@Nullable String message,
Throwable thrown)
on in interface ExceptionHandlerclazz - the class where the exception occurred. Must not be null.message - a custom message detailing the error, or null.thrown - the throwable instance representing the error, or null.public void on(@NotNull
@NotNull org.slf4j.Logger logger,
@Nullable
@Nullable String message,
Throwable thrown)
on in interface ExceptionHandlerlogger - the logger instance. Must not be null.message - a custom message detailing the error, or null.thrown - the throwable instance representing the error, or null.Copyright © 2026 Chronicle Software Ltd. All rights reserved.