Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-25852

Fix Tomcat JULI configuration conflicting with log4j2

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.3

      Description

      Since NXP-23863 we upgraded our logging backend to log4j2.
      Since then, JUL/JULI configuration present in conf/logging.properties sometimes raises this issue: (case on pack war)

      19:07:30 [INFO]      [exec] Can't load log handler "1catalina.org.apache.juli.AsyncFileHandler"
      19:07:30 [INFO]      [exec] java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler
      19:07:30 [INFO]      [exec] java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler
      19:07:30 [INFO]      [exec] 	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      19:07:30 [INFO]      [exec] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      19:07:30 [INFO]      [exec] 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
      19:07:30 [INFO]      [exec] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      19:07:30 [INFO]      [exec] 	at java.util.logging.LogManager$5.run(LogManager.java:965)
      19:07:30 [INFO]      [exec] 	at java.security.AccessController.doPrivileged(Native Method)
      19:07:30 [INFO]      [exec] 	at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
      19:07:30 [INFO]      [exec] 	at java.util.logging.LogManager.addLogger(LogManager.java:1165)
      19:07:30 [INFO]      [exec] 	at java.util.logging.LogManager$2.run(LogManager.java:349)
      19:07:30 [INFO]      [exec] 	at java.security.AccessController.doPrivileged(Native Method)
      19:07:30 [INFO]      [exec] 	at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
      19:07:30 [INFO]      [exec] 	at java.util.logging.LogManager.getLogManager(LogManager.java:378)
      19:07:30 [INFO]      [exec] 	at java.util.logging.Logger.demandLogger(Logger.java:448)
      19:07:30 [INFO]      [exec] 	at java.util.logging.Logger.getLogger(Logger.java:502)
      19:07:30 [INFO]      [exec] 	at com.sun.jmx.remote.util.ClassLogger.<init>(ClassLogger.java:55)
      19:07:30 [INFO]      [exec] 	at javax.management.NotificationBroadcasterSupport.<clinit>(NotificationBroadcasterSupport.java:365)
      19:07:30 [INFO]      [exec] 	at javax.management.MBeanServerDelegate.<init>(MBeanServerDelegate.java:72)
      19:07:30 [INFO]      [exec] 	at com.sun.jmx.mbeanserver.MBeanServerDelegateImpl.<init>(MBeanServerDelegateImpl.java:100)
      19:07:30 [INFO]      [exec] 	at com.sun.jmx.mbeanserver.JmxMBeanServer.newMBeanServerDelegate(JmxMBeanServer.java:1374)
      19:07:30 [INFO]      [exec] 	at javax.management.MBeanServerBuilder.newMBeanServerDelegate(MBeanServerBuilder.java:66)
      19:07:30 [INFO]      [exec] 	at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:321)
      19:07:30 [INFO]      [exec] 	at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:231)
      19:07:30 [INFO]      [exec] 	at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:192)
      19:07:30 [INFO]      [exec] 	at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:469)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:140)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:558)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:619)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:121)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.jcl.LogAdapter.getContext(LogAdapter.java:39)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.jcl.LogFactoryImpl.getInstance(LogFactoryImpl.java:40)
      19:07:30 [INFO]      [exec] 	at org.apache.logging.log4j.jcl.LogFactoryImpl.getInstance(LogFactoryImpl.java:55)
      19:07:30 [INFO]      [exec] 	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
      19:07:30 [INFO]      [exec] 	at org.nuxeo.runtime.deployment.preprocessor.PackWar.<clinit>(PackWar.java:71)
      

      This is due to presence of Log4j 2 bridges and Tomcat JULI at same time but without correct configuration.
      In our case Log4j takes precedence over Tomcat but doesn't know special JULI format for logging.properties

      We don't have this problem when starting Nuxeo because we change JUL LogManager in NuxeoTomcatLauncher#getServerProperties whereas JUL configuration file is given in nuxeoctl.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h