8152436: Add a test to verify that the root logger correctly reports the caller's information

Daniel Fuchs daniel.fuchs at oracle.com
Tue Mar 22 16:29:01 UTC 2016


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.

Hi Jason,

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.

best regards,

-- daniel

>
> Regards,
>
> Jason
>
> ________________________________________
> 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
>
> Hi,
>
> Please find below a new test that verifies that JDK-8152389 does
> not occur in JDK 9.
>
> bug:
> 8152436: Add a test to verify that the root logger correctly
>            reports the caller's information
> https://bugs.openjdk.java.net/browse/JDK-8152436
>
> Issue being verified by the test:
> https://bugs.openjdk.java.net/browse/JDK-8152389
>
> Webrev (test only):
> http://cr.openjdk.java.net/~dfuchs/webrev_8152436/webrev.00/
>
> best regards,
>
> -- daniel
>




More information about the core-libs-dev mailing list