org.apache.log4j.spi
public class LocationInfo extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
String |
fullInfo
All available caller information, in the format
fully.qualified.classname.of.caller.methodName(Filename.java:line) |
static String |
NA
When location information is not available the constant
NA is returned. |
Constructor and Description |
---|
LocationInfo(Throwable t,
String fqnOfCallingClass)
Instantiate location information based on a Throwable.
|
Modifier and Type | Method and Description |
---|---|
String |
getClassName()
Return the fully qualified class name of the caller making the
logging request.
|
String |
getFileName()
Return the file name of the caller.
|
String |
getLineNumber()
Returns the line number of the caller.
|
String |
getMethodName()
Returns the method name of the caller.
|
public String fullInfo
fully.qualified.classname.of.caller.methodName(Filename.java:line)
public static final String NA
NA
is returned. Current value of this string
constant is ?.public LocationInfo(Throwable t, String fqnOfCallingClass)
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 String getClassName()
public String getFileName()
This information is not always available.
public String getLineNumber()
This information is not always available.
public String getMethodName()
Copyright 2000-2005 Apache Software Foundation.