[jboss-jira] [JBoss JIRA] (WFLY-6359) Investigate consequences of changes in JDK9 on JBoss Logging

Richard Opalka (JIRA) issues at jboss.org
Wed Apr 20 10:34:00 EDT 2016


     [ https://issues.jboss.org/browse/WFLY-6359?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Opalka updated WFLY-6359:
---------------------------------
    Description: 
When running:

$[wildfly-core/logging]>mvn test -Dtest=**/Log4jAppenderTestCase

on JDK9 the test is failing.
{noformat}
levelTest(org.jboss.as.logging.logmanager.Log4jAppenderTestCase)  Time elapsed: 0.006 sec  <<< ERROR!
java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")
	at org.jboss.logmanager.Logger.getLogger(Logger.java:57)
	at org.jboss.as.logging.logmanager.Log4jAppenderTestCase.<init>(Log4jAppenderTestCase.java:49)

formatTest(org.jboss.as.logging.logmanager.Log4jAppenderTestCase)  Time elapsed: 0.001 sec  <<< ERROR!
java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")
	at org.jboss.logmanager.Logger.getLogger(Logger.java:57)
	at org.jboss.as.logging.logmanager.Log4jAppenderTestCase.<init>(Log4jAppenderTestCase.java:49)
{noformat}

After short debugging I identified the difference between JDK8 and JKD9 that is causing the test to fail. In JDK8 the relevant piece of code was:

{code}
// java.util.logging.Logger

   private static Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
        LogManager manager = LogManager.getLogManager();
        SecurityManager sm = System.getSecurityManager();
        if (sm != null && !SystemLoggerHelper.disableCallerCheck) {
            if (caller.getClassLoader() == null) {
                return manager.demandSystemLogger(name, resourceBundleName);
            }
        }
        return manager.demandLogger(name, resourceBundleName, caller);
        // ends up calling new Logger(name, resourceBundleName, caller)
        // iff the logger doesn't exist already
    }
{code}

in JDK9 the Security Manager check part disappeared:

{code}
// java.util.logging.Logger

   private static Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
        LogManager manager = LogManager.getLogManager();
        if (!SystemLoggerHelper.disableCallerCheck) {
            if (caller.getClassLoader() == null) {
                return manager.demandSystemLogger(name, resourceBundleName, caller);
            }
        }
        return manager.demandLogger(name, resourceBundleName, caller);
        // ends up calling new Logger(name, resourceBundleName, caller)
        // iff the logger doesn't exist already
    }
{code}

This change causes the platform java.util.logging.Logger is returned instead of expected one
org.jboss.logmanager.Logger.

It is possible to workaround this problem by setting sun.util.logging.disableCallerCheck JVM property, like:

$[wildfly-core/logging]>mvn test -Dtest=**/Log4jAppenderTestCase -Dsun.util.logging.disableCallerCheck=true

Please investigate, whether this is regression that should be addressed by Oracle and if there are not other potential problems affecting proper logging functionality on JDK9.

  was:
When running:

$[wildfly-core/logging]>mvn test -Dtest=**/Log4jAppenderTestCase

on JDK9 the test is failing. After short debugging I identified the difference between JDK8 and JKD9 that is causing the test to fail. In JDK8 the relevant piece of code was:

{code}
// java.util.logging.Logger

   private static Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
        LogManager manager = LogManager.getLogManager();
        SecurityManager sm = System.getSecurityManager();
        if (sm != null && !SystemLoggerHelper.disableCallerCheck) {
            if (caller.getClassLoader() == null) {
                return manager.demandSystemLogger(name, resourceBundleName);
            }
        }
        return manager.demandLogger(name, resourceBundleName, caller);
        // ends up calling new Logger(name, resourceBundleName, caller)
        // iff the logger doesn't exist already
    }
{code}

in JDK9 the Security Manager check part disappeared:

{code}
// java.util.logging.Logger

   private static Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
        LogManager manager = LogManager.getLogManager();
        if (!SystemLoggerHelper.disableCallerCheck) {
            if (caller.getClassLoader() == null) {
                return manager.demandSystemLogger(name, resourceBundleName, caller);
            }
        }
        return manager.demandLogger(name, resourceBundleName, caller);
        // ends up calling new Logger(name, resourceBundleName, caller)
        // iff the logger doesn't exist already
    }
{code}

This change causes the platform java.util.logging.Logger is returned instead of expected one
org.jboss.logmanager.Logger.

It is possible to workaround this problem by setting sun.util.logging.disableCallerCheck JVM property, like:

$[wildfly-core/logging]>mvn test -Dtest=**/Log4jAppenderTestCase -Dsun.util.logging.disableCallerCheck=true

Please investigate, whether this is regression that should be addressed by Oracle and if there are not other potential problems affecting proper logging functionality on JDK9.



> Investigate consequences of changes in JDK9 on JBoss Logging
> ------------------------------------------------------------
>
>                 Key: WFLY-6359
>                 URL: https://issues.jboss.org/browse/WFLY-6359
>             Project: WildFly
>          Issue Type: Task
>          Components: Logging
>    Affects Versions: 10.0.0.Final
>            Reporter: Richard Opalka
>            Assignee: James Perkins
>             Fix For: 10.1.0.Final
>
>
> When running:
> $[wildfly-core/logging]>mvn test -Dtest=**/Log4jAppenderTestCase
> on JDK9 the test is failing.
> {noformat}
> levelTest(org.jboss.as.logging.logmanager.Log4jAppenderTestCase)  Time elapsed: 0.006 sec  <<< ERROR!
> java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")
> 	at org.jboss.logmanager.Logger.getLogger(Logger.java:57)
> 	at org.jboss.as.logging.logmanager.Log4jAppenderTestCase.<init>(Log4jAppenderTestCase.java:49)
> formatTest(org.jboss.as.logging.logmanager.Log4jAppenderTestCase)  Time elapsed: 0.001 sec  <<< ERROR!
> java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")
> 	at org.jboss.logmanager.Logger.getLogger(Logger.java:57)
> 	at org.jboss.as.logging.logmanager.Log4jAppenderTestCase.<init>(Log4jAppenderTestCase.java:49)
> {noformat}
> After short debugging I identified the difference between JDK8 and JKD9 that is causing the test to fail. In JDK8 the relevant piece of code was:
> {code}
> // java.util.logging.Logger
>    private static Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
>         LogManager manager = LogManager.getLogManager();
>         SecurityManager sm = System.getSecurityManager();
>         if (sm != null && !SystemLoggerHelper.disableCallerCheck) {
>             if (caller.getClassLoader() == null) {
>                 return manager.demandSystemLogger(name, resourceBundleName);
>             }
>         }
>         return manager.demandLogger(name, resourceBundleName, caller);
>         // ends up calling new Logger(name, resourceBundleName, caller)
>         // iff the logger doesn't exist already
>     }
> {code}
> in JDK9 the Security Manager check part disappeared:
> {code}
> // java.util.logging.Logger
>    private static Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
>         LogManager manager = LogManager.getLogManager();
>         if (!SystemLoggerHelper.disableCallerCheck) {
>             if (caller.getClassLoader() == null) {
>                 return manager.demandSystemLogger(name, resourceBundleName, caller);
>             }
>         }
>         return manager.demandLogger(name, resourceBundleName, caller);
>         // ends up calling new Logger(name, resourceBundleName, caller)
>         // iff the logger doesn't exist already
>     }
> {code}
> This change causes the platform java.util.logging.Logger is returned instead of expected one
> org.jboss.logmanager.Logger.
> It is possible to workaround this problem by setting sun.util.logging.disableCallerCheck JVM property, like:
> $[wildfly-core/logging]>mvn test -Dtest=**/Log4jAppenderTestCase -Dsun.util.logging.disableCallerCheck=true
> Please investigate, whether this is regression that should be addressed by Oracle and if there are not other potential problems affecting proper logging functionality on JDK9.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list