public final class StackLocatorUtil extends Object
Modifier and Type | Method and Description |
---|---|
static StackTraceElement |
calcLocation(String fqcnOfLogger) |
static Class<?> |
getCallerClass(Class<?> anchor) |
static Class<?> |
getCallerClass(Class<?> sentinelClass,
Predicate<Class<?>> callerPredicate)
Search for a calling class.
|
static Class<?> |
getCallerClass(int depth) |
static Class<?> |
getCallerClass(String fqcn)
Equivalent to
getCallerClass(String, String) with an empty pkg . |
static Class<?> |
getCallerClass(String fqcn,
String pkg)
Search for a calling class.
|
static Stack<Class<?>> |
getCurrentStackTrace() |
static StackTraceElement |
getStackTraceElement(int depth) |
public static Class<?> getCallerClass(int depth)
public static StackTraceElement getStackTraceElement(int depth)
public static Class<?> getCallerClass(String fqcn)
getCallerClass(String, String)
with an empty pkg
.public static Class<?> getCallerClass(String fqcn, String pkg)
fqcn
- Root class name whose caller to search for.pkg
- Package name prefix that must be matched after the fqcn
has been found.public static Class<?> getCallerClass(Class<?> sentinelClass, Predicate<Class<?>> callerPredicate)
sentinelClass
- Sentinel class at which to begin searchingcallerPredicate
- Predicate checked after the sentinelClass is foundsentinelClass
is found.public static Class<?> getCallerClass(Class<?> anchor)
public static Stack<Class<?>> getCurrentStackTrace()
public static StackTraceElement calcLocation(String fqcnOfLogger)
Copyright © 1999-1969 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.