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
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. Regards, Jason ________________________________________ From: core-libs-dev <core-libs-dev-bounces@openjdk.java.net> on behalf of Daniel Fuchs <daniel.fuchs@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
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@openjdk.java.net> on behalf of Daniel Fuchs <daniel.fuchs@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
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. Regards, Jason ________________________________________ From: Daniel Fuchs <daniel.fuchs@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.
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@openjdk.java.net> on behalf of Daniel Fuchs <daniel.fuchs@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
On Mar 22, 2016, at 8:03 AM, Daniel Fuchs <daniel.fuchs@oracle.com> wrote:
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/
+1 It’d be nice to convert to TestNG test and could be done in a separate issue. Mandy
Agree, would be nice to have this as a TestNG test but good otherwise. Enjoy your time off Daniel On Mar 25, 2016, at 2:12 PM, Mandy Chung <mandy.chung@oracle.com> wrote:
On Mar 22, 2016, at 8:03 AM, Daniel Fuchs <daniel.fuchs@oracle.com> wrote:
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/
+1
It’d be nice to convert to TestNG test and could be done in a separate issue.
Mandy
Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen@oracle.com
participants (4)
-
Daniel Fuchs
-
Jason Mehrens
-
Lance Andersen
-
Mandy Chung