logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul <pgbak...@gmail.com>
Subject Re: Application Server integration in Tomcat
Date Wed, 20 Feb 2019 06:53:59 GMT
Yes, tomcat 9 on java 11

On Wed, Feb 20, 2019, 6:24 AM Ralph Goers <ralph.goers@dslextreme.com wrote:

> Were you using Tomcat 8.5 or greater? The instructions on the
> log4j-appserver page should work if you are using that version of Tomcat.
> Prior to that you will have to follow Tomcat’s instructions on how to
> replace the logging framework.
>
> Ralph
>
> > On Feb 19, 2019, at 9:03 AM, Paul <pgbakker@gmail.com> wrote:
> >
> > Hi,
> >
> > Am trying to get Tomcat to log internal stuff through Log4j2, but
> failing, no matter how I try.
> >
> > I've followed the instruction at
> https://logging.apache.org/log4j/2.x/log4j-appserver/index.html to no
> avail.
> >
> > I have a hard time understanding it, but maybe the problem is that the
> Log4j2 code is executed in a different classLoader than the tomcat code:
> I've enabled classloading debug output (-Xlog:class+load*=debug) and the
> status logger (-Dlog4j2.debug) and I see that all Tomcat code is executed
> by one classloader:
> >
> > loader: [loader data: 0x000055f64b4557e0 of 'bootstrap']
> >
> > whereas the Log4j2 code seems executed by a different classloader:
> >
> > loader: [loader data: 0x00005559e1327de0 for instance a
> 'jdk/internal/loader/ClassLoaders$AppClassLoader'{0x00000000e10c9c20}]
> >
> > I have this in setenv.sh and setenv.sh is working properly otherwise:
> > CLASSPATH="$CATALINA_HOME/lib/*"
> >
> > The $CATALINA_HOME/lib/ contains my log4j2-tomcat.properties and the
> log4j-api and log4j-core jars (alongside slf4j-api.jar and
> log4j-slf4j-impl.jar).  (all version 2.11.x)
> >
> > I've also tried with the log4j-webon the classPath, didn't make a
> difference. Tried the -Dlog4j.ignoreTCL=true options, no luck.
> >
> > In the end, my main purpose it to log everything that happens in the JVM
> through log4j2 to the console. I've also tried with log4j-jul-2.11.1.jar,
> but couldn't get that going either: one of the challenges I have is that I
> have a custom appender plugin that needs to be loaded within the same
> classLoader hierarchy as where my (single) webapp is running. In the end,
> I'll be running only 1 webapp, deployed as a WAR in TOmcat and the whole
> thing is dockerized, so neither Tomcat or the WAR are ever
> restarted/redeployed: if something needs to change, we'll deploy a new
> container image
> >
> > The output to the console of Tomcat is this:
> > Using CATALINA_BASE:   /usr/local/tomcat
> > Using CATALINA_HOME:   /usr/local/tomcat
> > Using CATALINA_TMPDIR: /usr/local/tomcat/temp
> > Using JRE_HOME: /usr/lib/jvm/zulu11.2.3-jdk11.0.1-linux_musl_x64
> > Using CLASSPATH:
> /usr/local/tomcat/lib/*:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
>
> > NOTE: Picked up JDK_JAVA_OPTIONS:
> --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED
> --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
> > NOTE: Picked up JDK_JAVA_OPTIONS:
> --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED
> --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
> > DEBUG StatusLogger Using ShutdownCallbackRegistry class
> org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry
> > INFO StatusLogger Log4j appears to be running in a Servlet environment,
> but there's no log4j-web module available. If you want better web container
> support, please add the log4j-web JAR to your web archive or server lib
> directory.
> > INFO StatusLogger Log4j appears to be running in a Servlet environment,
> but there's no log4j-web module available. If you want better web container
> support, please add the log4j-web JAR to your web archive or server lib
> directory.
> > DEBUG StatusLogger Took 0.143572 seconds to load 208 plugins from
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29
> > DEBUG StatusLogger PluginManager 'Converter' found 44 plugins
> > DEBUG StatusLogger Starting OutputStreamManager SYSTEM_OUT.false.false-1
> > DEBUG StatusLogger Starting LoggerContext[name=799f7e29,
> org.apache.logging.log4j.core.LoggerContext@ae13544]...
> > DEBUG StatusLogger Reconfiguration started for context[name=799f7e29] at
> URI null (org.apache.logging.log4j.core.LoggerContext@ae13544) with
> optional ClassLoader: null
> > INFO StatusLogger Log4j appears to be running in a Servlet environment,
> but there's no log4j-web module available. If you want better web container
> support, please add the log4j-web JAR to your web archive or server lib
> directory.
> > DEBUG StatusLogger PluginManager 'ConfigurationFactory' found 4 plugins
> > INFO StatusLogger Log4j appears to be running in a Servlet environment,
> but there's no log4j-web module available. If you want better web container
> support, please add the log4j-web JAR to your web archive or server lib
> directory.
> > INFO StatusLogger Log4j appears to be running in a Servlet environment,
> but there's no log4j-web module available. If you want better web container
> support, please add the log4j-web JAR to your web archive or server lib
> directory.
> > DEBUG StatusLogger Missing dependencies for Yaml support,
> ConfigurationFactory
> org.apache.logging.log4j.core.config.yaml.YamlConfigurationFactory is
> inactive
> > INFO StatusLogger Log4j appears to be running in a Servlet environment,
> but there's no log4j-web module available. If you want better web container
> support, please add the log4j-web JAR to your web archive or server lib
> directory.
> > DEBUG StatusLogger Missing dependencies for Json support,
> ConfigurationFactory
> org.apache.logging.log4j.core.config.json.JsonConfigurationFactory is
> inactive
> > INFO StatusLogger Log4j appears to be running in a Servlet environment,
> but there's no log4j-web module available. If you want better web container
> support, please add the log4j-web JAR to your web archive or server lib
> directory.
> > DEBUG StatusLogger Using configurationFactory
> org.apache.logging.log4j.core.config.ConfigurationFactory$Factory@4e50c791
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.properties] using
> context class loader
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.properties] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.properties] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.properties] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.yml] using
> context class loader
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.yml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.yml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.yml] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.yaml] using
> context class loader
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.yaml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.yaml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.yaml] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.json] using
> context class loader
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.json] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.json] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.json] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.jsn] using
> context class loader
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.jsn] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.jsn] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.jsn] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.xml] using
> context class loader
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.xml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.xml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test799f7e29.xml] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2-test.properties] using context
> class loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test.properties] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.properties] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.properties] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2-test.yml] using context class
> loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test.yml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.yml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.yml] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2-test.yaml] using context class
> loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test.yaml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.yaml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.yaml] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2-test.json] using context class
> loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test.json] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.json] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.json] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2-test.jsn] using context class
> loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test.jsn] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.jsn] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.jsn] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2-test.xml] using context class
> loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2-test.xml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.xml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2-test.xml] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2799f7e29.properties] using
> context class loader
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.properties] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.properties] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.properties] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2799f7e29.yml] using context
> class loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.yml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.yml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.yml] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2799f7e29.yaml] using context
> class loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.yaml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.yaml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.yaml] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2799f7e29.json] using context
> class loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.json] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.json] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.json] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2799f7e29.jsn] using context
> class loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.jsn] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.jsn] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.jsn] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2799f7e29.xml] using context
> class loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.xml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.xml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2799f7e29.xml] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2.properties] using context
> class loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2.properties] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.properties] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.properties] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2.yml] using context class
> loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2.yml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.yml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.yml] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2.yaml] using context class
> loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2.yaml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.yaml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.yaml] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2.json] using context class
> loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2.json] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.json] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.json] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2.jsn] using context class
> loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2.jsn] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.jsn] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.jsn] using
> ClassLoader.getSystemResource().
> > TRACE StatusLogger Trying to find [log4j2.xml] using context class
> loader jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29.
> > TRACE StatusLogger Trying to find [log4j2.xml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.xml] using
> jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 class loader.
> > TRACE StatusLogger Trying to find [log4j2.xml] using
> ClassLoader.getSystemResource().
> > ERROR StatusLogger No Log4j 2 configuration file found. Using default
> configuration (logging only errors to the console), or user
> programmatically provided configurations. Set system property
> 'log4j2.debug' to show Log4j 2 internal initialization logging. See
> https://logging.apache.org/log4j/2.x/manual/configuration.html for
> instructions on how to configure Log4j 2
> > INFO StatusLogger Log4j appears to be running in a Servlet environment,
> but there's no log4j-web module available. If you want better web container
> support, please add the log4j-web JAR to your web archive or server lib
> directory.
> >
> >
> > ---
> > This email has been checked for viruses by AVG.
> > https://www.avg.com
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message