https://issues.apache.org/bugzilla/show_bug.cgi?id=44888
--- Comment #6 from Ralph Goers <[EMAIL PROTECTED]> 2008-05-16 00:49:47 PST ---
I ran the build and it was successful. I modified the Appender code I showed
below to print the stacktrace and the info in LocationInfo before it was
corrected. From that I was able to determine what the problem is. The code is
only matching up to a class name the length of the FQCN. In the case below that
means it matches LoggerUtilTest when it shouldn't have. I modified
LocationInfoTest with a new test case and created a new class to simulate the
behvior and it failed. If included both after the stack trace.
I'll still look into creating a Java 5 version of this. However you fix this
for 1.3 is just going to make it even slower.
className: sun.reflect.NativeMethodAccessorImpl
filename: ?
lineNumber: ?
methodName: invoke0
FQCN: com.diginsite.services.logging.LoggerUtil
java.lang.Throwable
at
org.apache.log4j.spi.LocationAppender.append(LocationAppender.java:20)
at
org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.log(Category.java:856)
at org.slf4j.impl.Log4jLoggerAdapter.log(Log4jLoggerAdapter.java:509)
at
com.diginsite.services.logging.LoggerUtil.entering(LoggerUtil.java:121)
at
com.diginsite.services.logging.LoggerUtilTest.testDefaultEntering(LoggerUtilTest.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
new test case for LocationInfoTest.java
/**
* Tests creation of location info from a throwable and where the
* FQCN is part of the caller's name.
*/
public void testLocationInfo() {
LocationInfo li = new LocationIn().getLocationInfo();
final String className = LocationInfoTest.class.getName();
final String methodName = "testLocationInfo";
final String fileName = "LocationInfoTest.java";
final String lineNumber = "49";
assertEquals(className, li.getClassName());
assertEquals(methodName, li.getMethodName());
assertEquals(fileName, li.getFileName());
assertEquals(lineNumber, li.getLineNumber());
assertEquals(className + "." + methodName
+ "(" + fileName + ":" + lineNumber + ")",
li.fullInfo);
}
LocationIn.java
package org.apache.log4j.spi;
/**
*
*/
public class LocationIn
{
public LocationInfo getLocationInfo()
{
Throwable t = new Throwable();
String fqcn = LocationIn.class.getName();
return new LocationInfo(t, fqcn);
}
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]