I followed the instructions at
http://logging.apache.org/log4j/2.x/log4j-appserver/index.html
<http://logging.apache.org/log4j/2.x/log4j-appserver/index.html> with Tomcat 9
and I was able to have tomcat use Log4j for logging without any problems. I
will try adding a web app that uses Log4j 2 next. Here is the output from
startup.
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
2019-02-22 16:14:42,708 main DEBUG Starting LoggerContext[name=Tomcat] from
configuration at
file:/opt/tomcat/apache-tomcat-9.0.16/log4j2/conf/log4j2-tomcat.xml
2019-02-22 16:14:42,711 main DEBUG Starting LoggerContext[name=Tomcat,
org.apache.logging.log4j.core.LoggerContext@a1cdc6d] with configuration
XmlConfiguration[location=/opt/tomcat/apache-tomcat-9.0.16/log4j2/conf/log4j2-tomcat.xml]...
2019-02-22 16:14:42,711 main DEBUG Shutdown hook enabled. Registering a new one.
2019-02-22 16:14:42,742 main DEBUG Apache Log4j Core 2.11.2 initializing
configuration
XmlConfiguration[location=/opt/tomcat/apache-tomcat-9.0.16/log4j2/conf/log4j2-tomcat.xml]
2019-02-22 16:14:42,747 main DEBUG Installed 1 script engine
Warning: Nashorn engine is planned to be removed from a future JDK release
2019-02-22 16:14:43,000 main DEBUG Oracle Nashorn version: 11, language:
ECMAScript, threading: Not Thread Safe, compile: true, names: [nashorn,
Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript], factory
class: jdk.nashorn.api.scripting.NashornScriptEngineFactory
2019-02-22 16:14:43,000 main DEBUG PluginManager 'Core' found 117 plugins
2019-02-22 16:14:43,000 main DEBUG PluginManager 'Level' found 0 plugins
2019-02-22 16:14:43,004 main DEBUG Building Plugin[name=property,
class=org.apache.logging.log4j.core.config.Property].
2019-02-22 16:14:43,012 main DEBUG PluginManager 'TypeConverter' found 26
plugins
2019-02-22 16:14:43,019 main DEBUG createProperty(name="logDir",
value="/opt/tomcat/apache-tomcat-9.0.16/logs")
2019-02-22 16:14:43,020 main DEBUG Building Plugin[name=properties,
class=org.apache.logging.log4j.core.config.PropertiesPlugin].
2019-02-22 16:14:43,023 main DEBUG
configureSubstitutor(={logDir=/opt/tomcat/apache-tomcat-9.0.16/logs},
Configuration(tomcat))
2019-02-22 16:14:43,023 main DEBUG PluginManager 'Lookup' found 13 plugins
2019-02-22 16:14:43,024 main DEBUG Building Plugin[name=filter,
class=org.apache.logging.log4j.core.filter.ThresholdFilter].
2019-02-22 16:14:43,025 main DEBUG createFilter(level="DEBUG", onMatch="null",
onMismatch="null")
2019-02-22 16:14:43,025 main DEBUG Building Plugin[name=filters,
class=org.apache.logging.log4j.core.filter.CompositeFilter].
2019-02-22 16:14:43,027 main DEBUG createFilters(={DEBUG})
2019-02-22 16:14:43,027 main DEBUG Building Plugin[name=layout,
class=org.apache.logging.log4j.core.layout.PatternLayout].
2019-02-22 16:14:43,031 main DEBUG PatternLayout$Builder(pattern="%d %p %C{1.}
[%t] %m%n", PatternSelector=null, Configuration(tomcat), Replace=null,
charset="null", alwaysWriteExceptions="null", disableAnsi="null",
noConsoleNoAnsi="null", header="null", footer="null")
2019-02-22 16:14:43,031 main DEBUG PluginManager 'Converter' found 44 plugins
2019-02-22 16:14:43,038 main DEBUG Building
Plugin[name=TimeBasedTriggeringPolicy,
class=org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy].
2019-02-22 16:14:43,041 main DEBUG
TimeBasedTriggeringPolicy$Builder(interval="1", modulate="true",
maxRandomDelay="null")
2019-02-22 16:14:43,042 main DEBUG Building
Plugin[name=SizeBasedTriggeringPolicy,
class=org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy].
2019-02-22 16:14:43,042 main DEBUG createPolicy(size="10MB")
2019-02-22 16:14:43,043 main DEBUG Building Plugin[name=appender,
class=org.apache.logging.log4j.core.appender.RollingFileAppender].
2019-02-22 16:14:43,048 main DEBUG
RollingFileAppender$Builder(fileName="/opt/tomcat/apache-tomcat-9.0.16/logs/catalina.out",
filePattern="/opt/tomcat/apache-tomcat-9.0.16/logs/catalina-%d{MM-dd-yy}.log.gz",
append="null", locking="null",
TimeBasedTriggeringPolicy(TimeBasedTriggeringPolicy(nextRolloverMillis=0,
interval=1, modulate=true)), Strategy=null, advertise="null",
advertiseUri="null", createOnDemand="null", filePermissions="null",
fileOwner="null", fileGroup="null", bufferedIo="null", bufferSize="null",
immediateFlush="null", ignoreExceptions="null", PatternLayout(%d %p %C{1.} [%t]
%m%n), name="RollingFile", Configuration(tomcat), Filter=null, ={})
2019-02-22 16:14:43,048 main ERROR appender RollingFile has no parameter that
matches element SizeBasedTriggeringPolicy
2019-02-22 16:14:43,054 main DEBUG Returning file creation time for
/opt/tomcat/apache-tomcat-9.0.16/logs/catalina.out
2019-02-22 16:14:43,055 main DEBUG Starting RollingFileManager
/opt/tomcat/apache-tomcat-9.0.16/logs/catalina.out
2019-02-22 16:14:43,057 main DEBUG PluginManager 'FileConverter' found 2 plugins
2019-02-22 16:14:43,058 main DEBUG Setting prev file time to
2019-02-22T16:14:42.000-0700
2019-02-22 16:14:43,059 main DEBUG Initializing triggering policy
TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=true)
2019-02-22 16:14:43,059 main DEBUG Building Plugin[name=appenders,
class=org.apache.logging.log4j.core.config.AppendersPlugin].
2019-02-22 16:14:43,060 main DEBUG createAppenders(={RollingFile})
2019-02-22 16:14:43,060 main DEBUG Building Plugin[name=AppenderRef,
class=org.apache.logging.log4j.core.config.AppenderRef].
2019-02-22 16:14:43,060 main DEBUG createAppenderRef(ref="RollingFile",
level="null", Filter=null)
2019-02-22 16:14:43,061 main DEBUG Building Plugin[name=root,
class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
2019-02-22 16:14:43,061 main DEBUG createLogger(additivity="null",
level="INFO", includeLocation="null", ={RollingFile}, ={},
Configuration(tomcat), Filter=null)
2019-02-22 16:14:43,062 main DEBUG Building Plugin[name=loggers,
class=org.apache.logging.log4j.core.config.LoggersPlugin].
2019-02-22 16:14:43,063 main DEBUG createLoggers(={root})
2019-02-22 16:14:43,063 main DEBUG Configuration
XmlConfiguration[location=/opt/tomcat/apache-tomcat-9.0.16/log4j2/conf/log4j2-tomcat.xml]
initialized
2019-02-22 16:14:43,063 main DEBUG Starting configuration
XmlConfiguration[location=/opt/tomcat/apache-tomcat-9.0.16/log4j2/conf/log4j2-tomcat.xml]
2019-02-22 16:14:43,064 main DEBUG Started configuration
XmlConfiguration[location=/opt/tomcat/apache-tomcat-9.0.16/log4j2/conf/log4j2-tomcat.xml]
OK.
2019-02-22 16:14:43,065 main DEBUG Shutting down OutputStreamManager
SYSTEM_OUT.false.false-1
2019-02-22 16:14:43,065 main DEBUG Shut down OutputStreamManager
SYSTEM_OUT.false.false-1, all resources released: true
2019-02-22 16:14:43,065 main DEBUG Appender DefaultConsole-1 stopped with
status true
2019-02-22 16:14:43,066 main DEBUG Stopped
org.apache.logging.log4j.core.config.DefaultConfiguration@704921a5 OK
2019-02-22 16:14:43,149 main DEBUG Registering MBean
org.apache.logging.log4j2:type=Tomcat
2019-02-22 16:14:43,151 main DEBUG Registering MBean
org.apache.logging.log4j2:type=Tomcat,component=StatusLogger
2019-02-22 16:14:43,152 main DEBUG Registering MBean
org.apache.logging.log4j2:type=Tomcat,component=ContextSelector
2019-02-22 16:14:43,152 main DEBUG Registering MBean
org.apache.logging.log4j2:type=Tomcat,component=Loggers,name=
2019-02-22 16:14:43,153 main DEBUG Registering MBean
org.apache.logging.log4j2:type=Tomcat,component=Appenders,name=RollingFile
2019-02-22 16:14:43,156 main DEBUG
org.apache.logging.log4j.core.util.SystemClock supports precise timestamps.
2019-02-22 16:14:43,156 main DEBUG LoggerContext[name=Tomcat,
org.apache.logging.log4j.core.LoggerContext@a1cdc6d] started OK with
configuration
XmlConfiguration[location=/opt/tomcat/apache-tomcat-9.0.16/log4j2/conf/log4j2-tomcat.xml].
2019-02-22 16:14:43,369 INFO o.a.c.s.VersionLoggerListener [main] Server
version name: Apache Tomcat/9.0.16
2019-02-22 16:14:43,375 INFO o.a.c.s.VersionLoggerListener [main] Server built:
Feb 4 2019 16:30:29 UTC
2019-02-22 16:14:43,375 INFO o.a.c.s.VersionLoggerListener [main] Server
version number: 9.0.16.0
2019-02-22 16:14:43,376 INFO o.a.c.s.VersionLoggerListener [main] OS Name:
Mac OS X
2019-02-22 16:14:43,376 INFO o.a.c.s.VersionLoggerListener [main] OS Version:
10.14.3
2019-02-22 16:14:43,376 INFO o.a.c.s.VersionLoggerListener [main] Architecture:
x86_64
2019-02-22 16:14:43,377 INFO o.a.c.s.VersionLoggerListener [main] Java Home:
/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
2019-02-22 16:14:43,377 INFO o.a.c.s.VersionLoggerListener [main] JVM Version:
11+28
2019-02-22 16:14:43,377 INFO o.a.c.s.VersionLoggerListener [main] JVM Vendor:
Oracle Corporation
2019-02-22 16:14:43,378 INFO o.a.c.s.VersionLoggerListener [main]
CATALINA_BASE: /opt/tomcat/apache-tomcat-9.0.16
2019-02-22 16:14:43,378 INFO o.a.c.s.VersionLoggerListener [main]
CATALINA_HOME: /opt/tomcat/apache-tomcat-9.0.16
2019-02-22 16:14:43,378 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument: --add-opens=java.base/java.lang=ALL-UNNAMED
2019-02-22 16:14:43,378 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument: --add-opens=java.base/java.io=ALL-UNNAMED
2019-02-22 16:14:43,379 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
2019-02-22 16:14:43,379 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument:
-Djava.util.logging.config.file=/opt/tomcat/apache-tomcat-9.0.16/conf/logging.properties
2019-02-22 16:14:43,379 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
2019-02-22 16:14:43,379 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument: -Djdk.tls.ephemeralDHKeySize=2048
2019-02-22 16:14:43,379 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
2019-02-22 16:14:43,380 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
2019-02-22 16:14:43,380 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument: -Dignore.endorsed.dirs=
2019-02-22 16:14:43,380 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument: -Dcatalina.base=/opt/tomcat/apache-tomcat-9.0.16
2019-02-22 16:14:43,380 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument: -Dcatalina.home=/opt/tomcat/apache-tomcat-9.0.16
2019-02-22 16:14:43,380 INFO o.a.c.s.VersionLoggerListener [main] Command line
argument: -Djava.io.tmpdir=/opt/tomcat/apache-tomcat-9.0.16/temp
2019-02-22 16:14:43,381 INFO o.a.c.c.AprLifecycleListener [main] The APR based
Apache Tomcat Native library which allows optimal performance in production
environments was not found on the java.library.path:
[/Users/rgoers/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2019-02-22 16:14:43,411 INFO o.a.c.AbstractProtocol [main] Initializing
ProtocolHandler ["http-nio-8080"]
2019-02-22 16:14:43,450 INFO o.a.c.AbstractProtocol [main] Initializing
ProtocolHandler ["ajp-nio-8009"]
2019-02-22 16:14:43,452 INFO o.a.c.s.Catalina [main] Server initialization in
[265] milliseconds
2019-02-22 16:14:43,495 INFO o.a.c.c.StandardService [main] Starting service
[Catalina]
2019-02-22 16:14:43,495 INFO o.a.c.c.StandardEngine [main] Starting Servlet
engine: [Apache Tomcat/9.0.16]
2019-02-22 16:14:43,502 INFO o.a.c.s.HostConfig [main] Deploying web
application directory [/opt/tomcat/apache-tomcat-9.0.16/webapps/docs]
2019-02-22 16:14:43,797 INFO o.a.c.s.HostConfig [main] Deployment of web
application directory [/opt/tomcat/apache-tomcat-9.0.16/webapps/docs] has
finished in [295] ms
2019-02-22 16:14:43,797 INFO o.a.c.s.HostConfig [main] Deploying web
application directory [/opt/tomcat/apache-tomcat-9.0.16/webapps/manager]
2019-02-22 16:14:43,840 INFO o.a.c.s.HostConfig [main] Deployment of web
application directory [/opt/tomcat/apache-tomcat-9.0.16/webapps/manager] has
finished in [43] ms
2019-02-22 16:14:43,841 INFO o.a.c.s.HostConfig [main] Deploying web
application directory [/opt/tomcat/apache-tomcat-9.0.16/webapps/examples]
2019-02-22 16:14:44,165 INFO o.a.c.c.ApplicationContext [main] ContextListener:
contextInitialized()
2019-02-22 16:14:44,165 INFO o.a.c.c.ApplicationContext [main] SessionListener:
contextInitialized()
2019-02-22 16:14:44,166 INFO o.a.c.c.ApplicationContext [main] ContextListener:
attributeAdded('StockTicker', 'async.Stockticker@1976f537')
2019-02-22 16:14:44,170 INFO o.a.c.s.HostConfig [main] Deployment of web
application directory [/opt/tomcat/apache-tomcat-9.0.16/webapps/examples] has
finished in [329] ms
2019-02-22 16:14:44,170 INFO o.a.c.s.HostConfig [main] Deploying web
application directory [/opt/tomcat/apache-tomcat-9.0.16/webapps/ROOT]
2019-02-22 16:14:44,186 INFO o.a.c.s.HostConfig [main] Deployment of web
application directory [/opt/tomcat/apache-tomcat-9.0.16/webapps/ROOT] has
finished in [16] ms
2019-02-22 16:14:44,186 INFO o.a.c.s.HostConfig [main] Deploying web
application directory [/opt/tomcat/apache-tomcat-9.0.16/webapps/host-manager]
2019-02-22 16:14:44,202 INFO o.a.c.s.HostConfig [main] Deployment of web
application directory [/opt/tomcat/apache-tomcat-9.0.16/webapps/host-manager]
has finished in [16] ms
2019-02-22 16:14:44,207 INFO o.a.c.AbstractProtocol [main] Starting
ProtocolHandler ["http-nio-8080"]
2019-02-22 16:14:44,217 INFO o.a.c.AbstractProtocol [main] Starting
ProtocolHandler ["ajp-nio-8009"]
2019-02-22 16:14:44,220 INFO o.a.c.s.Catalina [main] Server startup in [767]
milliseconds
Ralph
> On Feb 22, 2019, at 2:05 PM, Paul <[email protected]> wrote:
>
> I'll double-check again, but I'm pretty confident the class is there only
> once
>
> On Fri, Feb 22, 2019, 9:33 PM Ralph Goers <[email protected]>
> wrote:
>
>> If there the class exists in only one jar/directory then that class will
>> only be loaded once by the class loader that manages the jar or directory.
>> The only way you can have two instances of the class is if it is present in
>> two different class loaders. In the case of Tomcat, that would mean it has
>> to be present in both WEB-INF/lib or WEB-INF/classes and tomcat/lib.
>>
>> I am still in the process of testing log4j-appserver with Tomcat 9. I will
>> let you know what I find.
>>
>> Ralph
>>
>>> On Feb 22, 2019, at 12:30 PM, Paul <[email protected]> wrote:
>>>
>>> The 'error' I get is that the static field on my custom appender class is
>>> null when accessed from my webapp, long after log4j is initialized, while
>>> the appender constructor that log4j called sets is value.
>>>
>>> And the access to that static field happens long after log4j is
>> initialized.
>>>
>>> So my conclusion is that the appender class is loaded by multiple
>>> classloader
>>>
>>> Maybe it's using the java system classloader cause I'm using log4j-jul
>> (as
>>> log4j-appserver doesn't work)?
>>>
>>> Paul
>>>
>>> On Fri, Feb 22, 2019, 7:27 PM Ralph Goers <[email protected]>
>>> wrote:
>>>
>>>> Tomcat’s class loader will be a parent of the web app class loader. That
>>>> means the log4j-related classes placed in the tomcat class loader won’t
>> be
>>>> able to access anything in your web-app class loader. But your
>> application
>>>> should have no problem accessing them in tomcat’s class loader provided
>> you
>>>> don’t also have them in your web-app. That said, I haven’t looked at
>>>> Tomcat 9 yet. It is possible that they have an additional class loader
>> that
>>>> is not in the parent hierarchy of the web-app class loader. If that is
>> the
>>>> case your web app wouldn’t be able to access it. But then again, it
>>>> wouldn’t find Log4j either.
>>>>
>>>> What error do you get when you try to access the static fields?
>>>>
>>>> Ralph
>>>>
>>>>> On Feb 22, 2019, at 11:13 AM, Paul <[email protected]> wrote:
>>>>>
>>>>> Hi Ralph,
>>>>>
>>>>> See in between the lines.
>>>>>
>>>>> Curious to hear what your take is on the classloader usage which is
>> what
>>>> is causing my issues.
>>>>>
>>>>> Paul
>>>>>
>>>>> On 22/02/2019 18:43, Ralph Goers wrote:
>>>>>> I am not really clear on what you are trying to achieve so this answer
>>>> is making some guesses.
>>>>>>
>>>>>> A typical tomcat deployment will have a boot class loader, the tomcat
>>>> class loader and each web app will have its own class loader. Tomcat’s
>>>> logging has to happen using Tomcat’s class loader while the web app
>> uses a
>>>> combination of Tomcat’s and the Web Apps.
>>>>>>
>>>>>> It sounds like you want:
>>>>>> To use Log4j for tomcat logging.
>>>>>> To use Log4j for application logging.
>>>>>> To incorporate your own appenders for application logging.
>>>>> Correct
>>>>>>
>>>>>> What I am not clear about is if you have any custom stuff you want to
>>>> include for Tomcat logging. I am going to assume you don’t.
>>>>> Correct assumption, I don't need anything custom for Tomcat logging
>>>>>>
>>>>>> There are a couple of ways I would try to make this work. First, you
>>>> have to remember that in Tomcat the WebApp class loader is searched
>> first
>>>> before delegating to the Tomcat class loader and that any classes in the
>>>> Tomcat class loader won’t be able to directly access classes in the Web
>> App
>>>> class loader. If you place Log4j and your custom appenders in the tomcat
>>>> class loader and do not include them in your web app then everything
>> should
>>>> work. However, if your custom appenders have dependencies on a bunch of
>>>> custom code this can get pretty ugly as they would need to be in
>> tomcat/lib
>>>> as well.
>>>>>
>>>>> The custom appenders are standalone, they just have a public static
>>>> field that is accessed by code in my webapp.
>>>>>
>>>>> I tried doing as you described, but to no avail. It seems like the
>> log4j
>>>> stuff isn't loaded using the bootstrap/system or common classloader, but
>>>> through the Java system classloader. What I don't understand is why the
>>>> log4j stuff seems loaded by the Java system classloader and not the
>> Tomcat
>>>> classloaders... To my understanding: if any of the bootstrap/system or
>>>> common classloaders of Tomcat would be used, all would be good, as those
>>>> are all in the webapp classloader hierarchy, correct?
>>>>>
>>>>>>
>>>>>> Another way to deal with this would be to place the log4j jars in both
>>>> tomcat/lib and in the web application’s WEB-INF/lib. Tomcat will
>> initialize
>>>> using the Log4j jars it finds in tomcat/lib. The web app should use the
>>>> log4j jars from WEB-INF lib. In that case you will essentially have two
>>>> separate log4j implementations, which is pretty much what you have to
>> do to
>>>> accomplish what it sounds like you want.
>>>>> I haven't tried rolling two full log4j implementations, find that a bit
>>>> of waist of resources (@runtime, but also deployment-wise: we'll have
>> many
>>>> containers running using this setup)
>>>>>>
>>>>>> Also, by default Log4j uses the ClassLoaderContextSelector. This
>>>> insures that there are two LoggerContexts - one for tomcat and one for
>> your
>>>> web app. If you place everything in tomcat/lib you probably don’t want
>> to
>>>> use that ContextSelector. You probably would want to use the
>>>> BasicContextSelector for that.
>>>>>>
>>>>>> Ralph
>>>>>>
>>>>>>> On Feb 22, 2019, at 9:27 AM, Paul <[email protected]> wrote:
>>>>>>>
>>>>>>> Tnx
>>>>>>>
>>>>>>> I've also tried myself locally on my laptop (Wind10, Tomcat 9.0.16,
>>>> log4j2 2.11.2, Java 1.8.0_162) but the exact same problem.
>>>>>>>
>>>>>>> I've also looked at the docs on the Tomcat side: for Tomcat 9 the
>> docs
>>>> on logging don't mention this mechanism to use log4j anymore. On the 8.0
>>>> documentation it is there, but talks about Log4j 1 and also details how
>> you
>>>> need to replace the tomcat-juli(-adapters).jars, which I think is not
>>>> required anymore, see this case:
>>>> https://bz.apache.org/bugzilla/show_bug.cgi?id=58588. However, that
>> case
>>>> seems to suggest that the way to replace tomcats internal logging is
>>>> through JUL....
>>>>>>>
>>>>>>> So, I gave JUL another shot:
>>>>>>>
>>>>>>> - with all the log4j-core/api/jul/ and a log4j2.properties on the
>>>> classpath set through setenv.sh, I'm able to replace the internal
>> logging
>>>> of Tomcat using Log4j2. So far so good.
>>>>>>>
>>>>>>> - For the logging from the single webaap/WAR I'll ever deploy in this
>>>> tomcat instance, I have custom appenders that have static fields that
>> are
>>>> accessed from within the deployed webapp and through the log4j2 appender
>>>> interface methods. Hence, log4j2 and the webapp need to use the same
>>>> classloader (hierarchy), otherwise they'll be looking at teh same class
>>>> loaded through different classloaders, thus different instances of the
>>>> static field. I've got log4j2-web.jar and the jar containing my custom
>>>> appenders both in the WEB-INF/lib folder of my webapp + a
>> log4j2.properties
>>>> in the WEB-INF folder, but then Log4J can't find the custom appenders.
>> If I
>>>> put the jar with the custom appenders on the classpath via Tomcat's
>>>> setenv.sh, Log4J initializes properly, but the WebApp and Log4j seem to
>> use
>>>> 2 different classloaders, thus I run into the problem with multiple
>>>> instances of the static field
>>>>>>>
>>>>>>> Is there any setup I can use that works in this scenario?
>>>>>>>
>>>>>>> Paul
>>>>>>>
>>>>>>> On 20/02/2019 12:26, Apache wrote:
>>>>>>>> Ok. I will try it myself with both of those and let you know, but it
>>>> might take a couple of days.
>>>>>>>>
>>>>>>>> Ralph
>>>>>>>>
>>>>>>>>> On Feb 19, 2019, at 11:58 PM, Paul <[email protected]> wrote:
>>>>>>>>>
>>>>>>>>> With log4j-web on the classmate the INFO statements you mentioned
>>>>>>>>> disappear, but the problem of internal tomcat logging via log4j
>> isn't
>>>>>>>>> solved.
>>>>>>>>>
>>>>>>>>> And I've went through but those links many times, tried everything
>> I
>>>> could
>>>>>>>>> find there, but no avail
>>>>>>>>>
>>>>>>>>>> On Tue, Feb 19, 2019, 11:26 PM Remko Popma <[email protected]
>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Hi Paul,
>>>>>>>>>>
>>>>>>>>>> Please try adding the log4j-web jar to the classpath:
>>>>>>>>>>> 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.
>>>>>>>>>>
>>>>>>>>>> Also, this user manual page may be useful:
>>>>>>>>>> https://logging.apache.org/log4j/2.x/manual/webapp.html (and
>> maybe
>>>> this
>>>>>>>>>> one: https://logging.apache.org/log4j/2.x/manual/logsep.html).
>>>>>>>>>>
>>>>>>>>>> Remko.
>>>>>>>>>>
>>>>>>>>>> (Shameless plug) Every java main() method deserves
>>>> http://picocli.info
>>>>>>>>>>
>>>>>>>>>>> On Feb 20, 2019, at 1:03, Paul <[email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>> 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.
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>>
>>>>>>> ---
>>>>>>> This email has been checked for viruses by AVG.
>>>>>>> https://www.avg.com
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>> <mailto:[email protected]>
>>>>> For additional commands, e-mail: [email protected]
>>>> <mailto:[email protected]>
>>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>