StackIntrospector (LogKit API)
Keywords: org.apache.log.util.StackIntrospector,StackIntrospector class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.log.util
Class StackIntrospector

    java.lang.Object
      |
      +--org.apache.log.util.StackIntrospector

public final class StackIntrospector
extends Object

A set of utilities to inspect current stack frame.

Version:
  CVS $Revision: 1.13 $ $Date: 2003/02/09 23:33:25 $
Author:
  Avalon Development Team, Sylvain Wallez, Stuart Roebuck

Method Summary
`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.
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getCallerClass

    public static final Class getCallerClass(Class clazz)
                                      throws SecurityException

  Find the caller of the passed in Class. May return null if caller not found on execution stack

  Parameters:
    `clazz` - the Class to search for on stack to find caller of
  Returns:
    the Class of object that called parrameter class
  Throws:
    `SecurityException` - if an existing SecurityManager disallows construction of another SecurityManager and thus blocks method results

### getCallerClass

    public static final Class getCallerClass(Class clazz,
                                             int stackDepthOffset)

  Find the caller of the passed in Class. May return null if caller not found on execution stack

  Parameters:
    `clazz` - the Class to search for on stack to find caller of
    `stackDepthOffset` - Offset call-stack depth to find caller
  Returns:
    the Class of object that called parrameter class
  Throws:
    `SecurityException` - if an existing SecurityManager disallows construction of another SecurityManager and thus blocks method results

### getCallerMethod

    public static final 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.

  Parameters:
    `clazz` - the Class to search for on stack to find caller of
  Returns:
    The method path name in the form "the.package.path.Method"

### getRecentStack

    public static final 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.

  This can be useful for debugging code to determine where calls to a method are coming from.

  Parameters:
    `clazz` - the last class on the stack you are not interested in!
    `entries` - the number of stack lines to return.
  Returns:
    The method path name in the form "the.package.path.Method"

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001 Apache Jakarta Project. All Rights Reserved.