As I suspected your log shows it using the wrong ClassLoader to locate the configuration. Please create a Jira issue with this information.
Ralph > On Oct 5, 2017, at 1:31 AM, "billok...@gmail.com"<billok...@gmail.com> wrote: > > Thanks for looking into this! > > I do have a log4j2.xml in tomcat/lib, was thinking that would be used by the > common classloader for the commomLib log... > > I guess the problem is that the commonLib classes were only referenced by the > webapp code, thus the loggerContext for the commonLib was created during the > webapp loading. Followings are the debug logs for reference: > > --- > DEBUG StatusLogger Log4jServletContainerInitializer starting up Log4j in > Servlet 3.0+ environment. > DEBUG StatusLogger Using ShutdownCallbackRegistry class > org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry > DEBUG StatusLogger Using the servlet context name "webapp1". > DEBUG StatusLogger getConfigURI found [classpath:log4j2.xml] in > servletContext at [classpath:log4j2.xml] > DEBUG StatusLogger Took 0.119686 seconds to load 204 plugins from > WebappClassLoader > context: /webapp1 > delegate: false > repositories: > /WEB-INF/classes/ > ----------> Parent Classloader: > java.net.URLClassLoader@6dde5c8c > .. > DEBUG StatusLogger Starting LoggerContext[name=webapp1] from configuration at > classpath:log4j2.xml > .. > // then after initialized some of the code that referenced the commonLib > classes > > DEBUG StatusLogger Starting LoggerContext[name=6dde5c8c, > org.apache.logging.log4j.core.LoggerContext@3240b374]... > DEBUG StatusLogger Reconfiguration started for context[name=6dde5c8c] at URI > null (org.apache.logging.log4j.core.LoggerContext@3240b374) with optional > ClassLoader: null > DEBUG StatusLogger Using configurationFactory > org.apache.logging.log4j.core.config.ConfigurationFactory$Factory@5b34ed62 > TRACE StatusLogger Trying to find [log4j2-test6dde5c8c.properties] using > context class loader WebappClassLoader > context: /webapp1 > delegate: false > repositories: > /WEB-INF/classes/ > ----------> Parent Classloader: > java.net.URLClassLoader@6dde5c8c > .. > TRACE StatusLogger Trying to find [log4j2.jsn] using > ClassLoader.getSystemResource(). > TRACE StatusLogger Trying to find [log4j2.xml] using context class loader > WebappClassLoader > context: /webapp1 > delegate: false > repositories: > /WEB-INF/classes/ > ----------> Parent Classloader: > java.net.URLClassLoader@6dde5c8c > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org > For additional commands, e-mail: log4j-user-h...@logging.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org