org.apache.log.util
public final class StackIntrospector extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
StackIntrospector.CallStack
Hack to get the call stack as an array of classes.
|
Modifier and Type | Field and Description |
---|---|
private static StackIntrospector.CallStack |
c_callStack |
Modifier | Constructor and Description |
---|---|
private |
StackIntrospector()
Private constructor to block instantiation.
|
Modifier and Type | Method and Description |
---|---|
static Class |
getCallerClass(Class clazz)
Find the caller of the passed in Class.
|
static Class |
getCallerClass(Class clazz,
int stackDepthOffset)
Find the caller of the passed in Class.
|
static String |
getCallerMethod(Class clazz)
Get the method path name for the method from which the LogEvent was
created, this includes the path name and the source filename and line
number if the source was compiled with debugging on.
|
private static StackIntrospector.CallStack |
getCallStack()
Create Hack SecurityManager to get CallStack.
|
static String |
getRecentStack(Class clazz,
int entries)
Return the current call stack as a String, starting with the first call
in the stack after a reference to the
clazz class, and then
display entries entries. |
private static StackIntrospector.CallStack c_callStack
private StackIntrospector()
private static StackIntrospector.CallStack getCallStack() throws SecurityException
SecurityException
- if an existing SecurityManager disallows construction
of another SecurityManagerpublic static final Class getCallerClass(Class clazz) throws SecurityException
clazz
- the Class to search for on stack to find caller ofSecurityException
- if an existing SecurityManager disallows construction
of another SecurityManager and thus blocks method resultspublic static final Class getCallerClass(Class clazz, int stackDepthOffset)
clazz
- the Class to search for on stack to find caller ofstackDepthOffset
- Offset call-stack depth to find callerSecurityException
- if an existing SecurityManager disallows construction
of another SecurityManager and thus blocks method resultspublic static final String getCallerMethod(Class clazz)
clazz
- the Class to search for on stack to find caller ofpublic static final String getRecentStack(Class clazz, int entries)
clazz
class, and then
display entries
entries.
This can be useful for debugging code to determine where calls to a method are coming from.
clazz
- the last class on the stack you are not interested in!entries
- the number of stack lines to return.Copyright © 2003-2004 The Apache Software Foundation. All Rights Reserved.