https://issues.apache.org/bugzilla/show_bug.cgi?id=45721
Summary: [PATCH] when showing a stack trace - include the
relative package versions and optional jar name to aid
debugging
Product: Log4j
Version: 1.2
Platform: PC
OS/Version: Mac OS X 10.4
Status: NEW
Severity: normal
Priority: P2
Component: Other
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
Users tend to get stack traces quite a lot and then they fire them off to some
open source mailing list or forum asking for help. One of the first questions
by support teams is often 'OK, what version are you using'.
Given that its possible to figure out the actual version being used of each
class - either using the package information from the MANIFEST or by finding
the jar the class came from, it seems logical to include the version
information into a stack trace if it can be easily deduced.
One day the JVM might actually do this for us :)
In the meantime, here's a trivial patch which appends an optional String to
stack traces printed with log4j which includes the jar file name if it can be
deduced plus the Java Package version the line of code comes from.
Here's an example...
org.apache.log4j.config.PropertySetterException: Hello
at
org.apache.log4j.spi.ThrowableInformationTest.testStackTracePackageName(ThrowableInformationTest.java:306)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [1.5.0]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[1.5.0]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[1.5.0]
at java.lang.reflect.Method.invoke(Method.java:585) [1.5.0]
at junit.framework.TestCase.runTest(TestCase.java:154)
[junit-3.8.1.jar]
at junit.framework.TestCase.runBare(TestCase.java:127)
[junit-3.8.1.jar]
at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit-3.8.1.jar]
at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit-3.8.1.jar]
at junit.framework.TestResult.run(TestResult.java:109)
[junit-3.8.1.jar]
at junit.framework.TestCase.run(TestCase.java:118) [junit-3.8.1.jar]
at junit.textui.TestRunner.doRun(TestRunner.java:116) [junit-3.8.1.jar]
at
com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:94)
[idea_rt.jar]
at junit.textui.TestRunner.doRun(TestRunner.java:109) [junit-3.8.1.jar]
at
com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:22)
[idea_rt.jar]
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
[idea_rt.jar]
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
[idea_rt.jar]
So you can see what version of junit is being used (despite there being no
manifest information) along with the JDK implementation version.
e.g.
at java.lang.reflect.Method.invoke(Method.java:585) [1.5.0]
means we found the package number but couldn't find the jar file. Whereas
at junit.framework.TestCase.run(TestCase.java:118) [junit-3.8.1.jar]
means we found the jar file but the jar file has no manifest version
information.
--
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]