-
Enhancement
-
Resolution: Future Project
-
P4
-
None
-
6
-
x86
-
windows_2000
Name: rl43681 Date: 07/31/2003
A DESCRIPTION OF THE REQUEST :
java.util.logging.Logger
The Logger class in java.util.logging has several methods where the caller must suply class name and metod.
This is a drawback when doing hevy refactoring. (Ok. the class name can be stated in the caller as this.getClass().getName(), but the method?)
Wouldn't it be possible to extract this information from the stack? (Throwable objects already have StackTraceElement objects). Maybe it could be a feature on the current Thread object to provide this.
Actually this ended upp as two suggestions.
1) Provide getStackTrace() on the Thread class.
2) Let the Logger methods for logging figure out class and method of the caller by using getStackTrace(). Plus addition of line number in log output.
JUSTIFICATION :
Most important is that it would make refactoring much simpler.
Second is that the Log call would be more compact, less error prone and easier to write.
CUSTOMER SUBMITTED WORKAROUND :
Throwable t = new Throwable();
StackTraceElement[] stack = t.getStackTrace();
(Incident Review ID: 193265)
======================================================================
- relates to
-
JDK-6569068 Make java.util.logging.LogRecord easier to extend
-
- Open
-