Package org.apache.log4j.spi
Class LocationInfo
java.lang.Object
org.apache.log4j.spi.LocationInfo
- All Implemented Interfaces:
Serializable
The internal representation of caller location information.
- Since:
- 0.8.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionAll available caller information, in the formatfully.qualified.classname.of.caller.methodName(Filename.java:line)
static final String
When location information is not available the constantNA
is returned.static final LocationInfo
NA_LOCATION_INFO is provided for compatibility with log4j 1.3. -
Constructor Summary
ConstructorsConstructorDescriptionLocationInfo
(String file, String classname, String method, String line) Create new instance.LocationInfo
(Throwable t, String fqnOfCallingClass) Instantiate location information based on a Throwable. -
Method Summary
Modifier and TypeMethodDescriptionReturn the fully qualified class name of the caller making the logging request.Return the file name of the caller.Returns the line number of the caller.Returns the method name of the caller.
-
Field Details
-
fullInfo
All available caller information, in the formatfully.qualified.classname.of.caller.methodName(Filename.java:line)
-
NA
When location information is not available the constantNA
is returned. Current value of this string constant is ?.- See Also:
-
NA_LOCATION_INFO
NA_LOCATION_INFO is provided for compatibility with log4j 1.3.- Since:
- 1.2.15
-
-
Constructor Details
-
LocationInfo
Instantiate location information based on a Throwable. We expect the Throwablet
, to be in the formatjava.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.
- Parameters:
t
- throwable used to determine location, may be null.fqnOfCallingClass
- class name of first class considered part of the logging framework. Location will be site that calls a method on this class.
-
LocationInfo
Create new instance.- Parameters:
file
- source file nameclassname
- class namemethod
- methodline
- source line number- Since:
- 1.2.15
-
-
Method Details
-
getClassName
Return the fully qualified class name of the caller making the logging request. -
getFileName
Return the file name of the caller.This information is not always available.
-
getLineNumber
Returns the line number of the caller.This information is not always available.
-
getMethodName
Returns the method name of the caller.
-