You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2008/05/19 19:31:29 UTC
DO NOT REPLY [Bug 45039] New: Use Throwable.
getStackTrace to obtain stack trace when JDK 1.4 or later is available
https://issues.apache.org/bugzilla/show_bug.cgi?id=45039
Summary: Use Throwable.getStackTrace to obtain stack trace when
JDK 1.4 or later is available
Product: Log4j
Version: 1.2
Platform: PC
OS/Version: Mac OS X 10.4
Status: NEW
Severity: normal
Priority: P2
Component: Other
AssignedTo: log4j-dev@logging.apache.org
ReportedBy: carnold@apache.org
The LocationInfo constructor obtains the location of the logging request by
capturing the output of Throwable.printStackTrace and then parsing it to find
the earliest caller of any method on the fully qualified class name.
Unfortunately, this can be sensitive to differences in implementations of
Throwable.printStackTrace (see bug 42281 and 30588 for examples) or general
weaknesses in the parsing of the output (see bug 44888).
JDK 1.4 added Throwable.getStackTrace() to provide direct access to this info,
but since log4j still supports running on earlier platforms it can not depend
on the availability of this method. Building log4j does require at least a JDK
1.4 due to the use of Maven, so it could have explicit calls to
Throwable.getStackTrace() as long as it was prepared to catch an exception if
the method was not found and would fallback to the JDK 1.3 compatible behavior.
Or it could just use reflection.
--
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 45039] Use Throwable.getStackTrace to obtain stack
trace when JDK 1.4 or later is available
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45039
Curt Arnold <ca...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #2 from Curt Arnold <ca...@apache.org> 2008-08-12 13:28:23 PST ---
Committed rev 685300.
--
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 45039] Use Throwable.getStackTrace to obtain stack
trace when JDK 1.4 or later is available
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45039
Thorbjørn Ravn Andersen <th...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |45527
--
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 45039] Use Throwable.getStackTrace to obtain stack
trace when JDK 1.4 or later is available
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45039
Curt Arnold <ca...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks|45527 |
--
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 45039] Use Throwable.
getStackTrace to obtain stack trace when JDK 1.4 or later is available
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45039
--- Comment #1 from Thorbjørn Ravn Andersen <th...@gmail.com> 2008-07-02 17:25:46 PST ---
(In reply to comment #0)
> JDK 1.4 added Throwable.getStackTrace() to provide direct access to this info,
> but since log4j still supports running on earlier platforms it can not depend
> on the availability of this method. Building log4j does require at least a JDK
> 1.4 due to the use of Maven, so it could have explicit calls to
> Throwable.getStackTrace() as long as it was prepared to catch an exception if
> the method was not found and would fallback to the JDK 1.3 compatible behavior.
> Or it could just use reflection.
In my experience having code conforming to a given Java version gives problems
especially when having several of these each for their own Java version all put
in the same source tree.
Personally I think that the best way to do this kind of "call this method which
we know at runtime if it exists or not" is through reflection. If the code is
written and debugged first as a normal Java method it is not hard to transform
the finished result into reflection method calls.
--
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org