|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.x4juli.global.spi.location.LocationInfo
In java.util.logging.LogRecord are line number and source file
as information missing. They have to be obtained, which is an expensive
operation due to creating a new Throwable.
Logging API as a whole was originally done for Apache log4j. Juli is a port of main parts of that to complete the Java Logging APIs. All credits for initial idea, design, implementation, documentation belong to the log4j crew. This file was originally published by Mathias Rupprecht. Please use exclusively the appropriate mailing lists for questions, remarks and contribution.
| Field Summary | |
(package private) java.lang.String |
className
Caller's fully qualified class name. |
(package private) java.lang.String |
fileName
Caller's file name. |
(package private) java.lang.String |
fullInfo
All available caller information, in the format fully.qualified.classname.of.caller.methodName(Filename.java:line) |
(package private) java.lang.String |
lineNumber
Caller's line number. |
(package private) java.lang.String |
methodName
Caller's method name. |
static LocationInfo |
NA_LOCATION_INFO
NA_LOCATION_INFO is used in conjunction with deserialized LogRecords without real location info available. |
private static long |
serialVersionUID
|
| Constructor Summary | |
LocationInfo(java.util.logging.LogRecord record)
|
|
LocationInfo(java.lang.String fileName,
java.lang.String className,
java.lang.String methodName,
java.lang.String lineNumber)
|
|
LocationInfo(java.lang.Throwable t,
java.lang.String fqnOfInvokingClass)
Instantiate location information based on a Throwable. |
|
| Method Summary | |
boolean |
equals(java.lang.Object o)
|
java.lang.String |
getClassName()
Return the fully qualified class name of the caller making the logging request. |
java.lang.String |
getFileName()
Return the file name of the caller. |
java.lang.String |
getFullInfo()
Returns the full info. |
java.lang.String |
getLineNumber()
Returns the line number of the caller. |
java.lang.String |
getMethodName()
Returns the method name of the caller. |
int |
hashCode()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
private static final long serialVersionUID
java.lang.String lineNumber
java.lang.String fileName
java.lang.String className
java.lang.String methodName
transient java.lang.String fullInfo
fully.qualified.classname.of.caller.methodName(Filename.java:line)
public static final LocationInfo NA_LOCATION_INFO
| Constructor Detail |
public LocationInfo(java.lang.String fileName,
java.lang.String className,
java.lang.String methodName,
java.lang.String lineNumber)
public LocationInfo(java.util.logging.LogRecord record)
public LocationInfo(java.lang.Throwable t,
java.lang.String fqnOfInvokingClass)
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.
t - the throwable to check.fqnOfInvokingClass - the full qualified name of the caller. (In Juli
varying).| Method Detail |
public boolean equals(java.lang.Object o)
public int hashCode()
public java.lang.String getClassName()
public java.lang.String getFileName()
This information is not always available.
public java.lang.String getLineNumber()
This information is not always available.
public java.lang.String getMethodName()
public java.lang.String getFullInfo()
fully.qualified.classname.of.caller.methodName(Filename.java:line)
public java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||