public class Tracer extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static Predicate<Throwable> |
exceptionPredicate |
protected static Class<? extends Throwable>[] |
ignoreClasses |
protected static Class<? extends Throwable>[] |
traceClasses |
| Modifier | Constructor and Description |
|---|---|
protected |
Tracer() |
| Modifier and Type | Method and Description |
|---|---|
static Predicate<? extends Throwable> |
getExceptionPredicate()
Get exception predicate
|
static Class<? extends Throwable>[] |
getExceptionsToIgnore()
Get exception classes to ignore.
|
static Class<? extends Throwable>[] |
getExceptionsToTrace()
Get exception classes to trace.
|
static void |
setExceptionPredicate(Predicate<Throwable> exceptionPredicate)
set an exception predicate which indicates the exception should be traced(return true) or ignored(return false)
except for
BlockException |
static void |
setExceptionsToIgnore(Class<? extends Throwable>... ignoreClasses)
Set exceptions to ignore.
|
static void |
setExceptionsToTrace(Class<? extends Throwable>... traceClasses)
Set exception to trace.
|
protected static boolean |
shouldTrace(Throwable t)
Check whether the throwable should be traced.
|
static void |
trace(Throwable e)
Trace provided
Throwable to the resource entry in current context. |
static void |
trace(Throwable e,
int count)
Deprecated.
|
static void |
traceContext(Throwable e,
Context context)
Trace provided
Throwable to current entry of given entrance context. |
static void |
traceContext(Throwable e,
int count,
Context context)
Deprecated.
|
static void |
traceEntry(Throwable e,
Entry entry)
Trace provided
Throwable to the given resource entry. |
public static void trace(Throwable e)
Throwable to the resource entry in current context.e - exception to record@Deprecated public static void trace(Throwable e, int count)
Throwable to current entry in current context.e - exception to recordcount - exception count to addpublic static void traceContext(Throwable e, Context context)
Throwable to current entry of given entrance context.e - exception to recordcontext - target entrance context@Deprecated public static void traceContext(Throwable e, int count, Context context)
Throwable and add exception count to current entry in provided context.e - exception to recordcount - exception count to addpublic static void traceEntry(Throwable e, Entry entry)
Throwable to the given resource entry.e - exception to record@SafeVarargs public static void setExceptionsToTrace(Class<? extends Throwable>... traceClasses)
BlockException will be traced.
Note that if both setExceptionsToIgnore(Class[]) and this method is set,
the ExceptionsToIgnore will be of higher precedence.
traceClasses - the list of exception classes to trace.public static Class<? extends Throwable>[] getExceptionsToTrace()
@SafeVarargs public static void setExceptionsToIgnore(Class<? extends Throwable>... ignoreClasses)
BlockException will be traced.
Note that if both setExceptionsToTrace(Class[]) and this method is set,
the ExceptionsToIgnore will be of higher precedence.
ignoreClasses - the list of exception classes to ignore.public static Class<? extends Throwable>[] getExceptionsToIgnore()
public static Predicate<? extends Throwable> getExceptionPredicate()
public static void setExceptionPredicate(Predicate<Throwable> exceptionPredicate)
BlockExceptionexceptionPredicate - the exception predicateprotected static boolean shouldTrace(Throwable t)
t - the throwable to check.Copyright © 2021 Alibaba Group. All rights reserved.