Save This Page
Home » slf4j-1.5.5 » org.apache » log4j » spi » [javadoc | source]
org.apache.log4j.spi
public class: LocationInfo [javadoc | source]
java.lang.Object
   org.apache.log4j.spi.LocationInfo

All Implemented Interfaces:
    Serializable

The internal representation of caller location information.
Field Summary
transient  String lineNumber    Caller's line number. 
transient  String fileName    Caller's file name. 
transient  String className    Caller's fully qualified class name. 
transient  String methodName    Caller's method name. 
public  String fullInfo    All available caller information, in the format fully.qualified.classname.of.caller.methodName(Filename.java:line) 
public static final  String NA    When location information is not available the constant NA is returned. Current value of this string constant is ?
static final  long serialVersionUID     
public static final  LocationInfo NA_LOCATION_INFO    NA_LOCATION_INFO is provided for compatibility with log4j 1.3.
    since: 1.2.15 -
 
static  boolean inVisualAge     
Constructor:
 public LocationInfo(Throwable t,
    String fqnOfCallingClass) 
    Instantiate location information based on a Throwable. We expect the Throwable t, to be in the format
    java.lang.Throwable
    ...
    at org.apache.log4j.PatternLayout.format(PatternLayout.java:413)
    at org.apache.log4j.FileAppender.doAppend(FileAppender.java:183)
    at org.apache.log4j.Category.callAppenders(Category.java:131)
    at org.apache.log4j.Category.log(Category.java:512)
    at callers.fully.qualified.className.methodName(FileName.java:74)
    ...
    

    However, we can also deal with JIT compilers that "lose" the location information, especially between the parentheses.

 public LocationInfo(String file,
    String classname,
    String method,
    String line) 
    Create new instance.
    Parameters:
    file - source file name
    classname - class name
    method - method
    line - source line number
    since: 1.2.15 -
Method from org.apache.log4j.spi.LocationInfo Summary:
getClassName,   getFileName,   getLineNumber,   getMethodName
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.log4j.spi.LocationInfo Detail:
 public String getClassName() 
    Return the fully qualified class name of the caller making the logging request.
 public String getFileName() 
    Return the file name of the caller.

    This information is not always available.

 public String getLineNumber() 
    Returns the line number of the caller.

    This information is not always available.

 public String getMethodName() 
    Returns the method name of the caller.