8152436: Add a test to verify that the root logger correctly reports the caller's information
jason_mehrens at hotmail.com
Tue Mar 22 16:58:08 UTC 2016
Understood. When I tested a subclassed logger all of the JDKs work correctly. I didn't check but it just seems like something that could regress if there is no test.
From: Daniel Fuchs <daniel.fuchs at oracle.com>
Sent: Tuesday, March 22, 2016 11:29 AM
To: Jason Mehrens; core-libs-dev
Subject: Re: 8152436: Add a test to verify that the root logger correctly reports the caller's information
On 22/03/16 17:11, Jason Mehrens wrote:
> Hi Daniel,
> I think we just need to add a test where a subclass logger logs the message with the root logger as the parent. Should be no need to register that logger with the LogManager.
> Not sure if it is worth checking that custom filters installed on handlers or logger and or formatters fool anything.
That would be another issue.
I believe the current behavior in 9 is that the custom logger
subclass will appear as the emitter of the log message, unless
it also implements System.Logger.
Now that we use the StackWalker API we have the opportunity
to use Class.isAssignableFrom to do the filtering - so we
could fix LogRecord::inferLogger to skip subclasses of
java.util.logging.Logger as well - which we can't do in 8
(well we could use Reflection.getCallerClass(int) in 8, but
that would not be a great idea - so I'd prefer to keep that as
a limitation for 8).
The test below is mainly to verify JDK-8152389 - which is about
verifying that calling Logger.getLogger("").xxxx() does
not report LogManager$RootLogger as the calling frame.
I should probably however log an RFE against 9 to skip
custom subclasses of java.util.logging.Logger when
inferring caller information. And then I'll just have to
extend the new test to also test this new scenario.
> From: core-libs-dev <core-libs-dev-bounces at openjdk.java.net> on behalf of Daniel Fuchs <daniel.fuchs at oracle.com>
> Sent: Tuesday, March 22, 2016 10:03 AM
> To: core-libs-dev
> Subject: RFR: 8152436: Add a test to verify that the root logger correctly reports the caller's information
> Please find below a new test that verifies that JDK-8152389 does
> not occur in JDK 9.
> 8152436: Add a test to verify that the root logger correctly
> reports the caller's information
> Issue being verified by the test:
> Webrev (test only):
> best regards,
> -- daniel
More information about the core-libs-dev