Q1. Why is the log4j2 framework starting before the servlet context is
called ?
Not sure. There could be some logging happening in a static initialization
block. This static block is called when its class is loaded, which would
cause Log4j2 to initialize itself.

You can see that Log4j2 tries to find a log4j2.xml (and
.json/.yaml/.properties) file in the classpath and is unable to do so.

This is because the log4j2.xml configuration file is located directly under
the WEB-INF folder, which is not in the classpath. It should be in
WEB-INF/classes instead.


Q2. How come the log4j2 get eventually configured?
In your code you tell Log4j2 the path to the configuration file. Not sure
why this works because I don't see Log4j2 re-configuring from the new
config location...

Q3. What is changing once I add the log4j2 listener before servlet context
listener?
Notice this error:

2017-08-17 17:16:08,359 localhost-startStop-1 ERROR Unable to create file
${sys:FTMIDDLE_LOGDIR}/FTMiddle.log java.io.IOException: The filename,
directory
name, or volume label syntax is incorrect

Could it be that the system property `FTMIDDLE_LOGDIR` does not have a
value? The system properties lookup failed and Log4j2 tries to create a
file named "${sys:FTMIDDLE_LOGDIR..."  This is not a valid file name in
windows, hence the error.










On Mon, Aug 21, 2017 at 4:32 PM, Darlea, Radu <radu.dar...@finastra.com>
wrote:

> Hi
>
>
>
> Anyone having a clue, please?
>
>
>
> Thx, Radu
>
>
>
> *From:* Darlea, Radu
> *Sent:* Thursday, August 17, 2017 6:10 PM
> *To:* log4j-user@logging.apache.org
> *Subject:* Log4j2 - setting programatically the env variable
>
>
>
> Hi
>
>
>
> Please find the snippet of web.xml
>
>
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
>
>
> <web-app xmlns="http://java.sun.com/xml/ns/javaee"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance";
>
>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>
>           http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd";
>
>     version="3.0">
>
>
>
>     <display-name>ft-middle</display-name>
>
>     <context-param>
>
>         <param-name>isLog4jAutoInitializationDisabled</param-name>
>
>         <param-value>true</param-value>
>
>     </context-param>
>
>
>
>     <listener>
>
>         <listener-class>summit.feserver.ContextListener</listener-class>
>
>     </listener>
>
>
>
>     <!-- Define servlet-mapped and path-mapped -->
>
>     <servlet>
>
>         <servlet-name>MessageHandler</servlet-name>
>
>         <servlet-class>summit.feserver.MessageHandlerServlet</
> servlet-class>
>
>         <init-param>
>
>             <param-name>packet_size</param-name>
>
>             <param-value>1024</param-value>
>
>             <description>Specify response packet size, in unit of
> KB</description>
>
>         </init-param>
>
>     </servlet>
>
>
>
> </web-app>
>
>
>
> Please find the deployed libraries
>
> juli-6.0.16.jar
>
> juli-LICENSE.txt
>
> log4j-1.2-api-2.8.2.jar
>
> log4j-api-2.8.2.jar
>
> log4j-core-2.8.2.jar
>
> log4j-web-2.8.2.jar
>
> in Tomcat 8.5.20
>
>
>
> Please find the log4j2 configuration saved as log4j2.xml in
> tomcat\webapps\ft_middle_ws\WEB-INF
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <Configuration status="warn">
>
>
>
>                 <Appenders>
>
>                                 <RollingFile name="FTDailyFileAppender"
> fileName="${sys:FTMIDDLE_LOGDIR}/FTMiddle.log"
> filePattern="${sys:FTMIDDLE_LOGDIR}/FTMiddle-%d{yyyy-MM-dd}.log">
>
>                                                 <PatternLayout>
>
>
> <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} -
> %msg%n</pattern>
>
>                                                 </PatternLayout>
>
>                                                 <Policies>
>
>
> <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>
>                                                 </Policies>
>
>                                 </RollingFile>
>
>
>
>                                 <Console name="console"
> target="SYSTEM_OUT">
>
>                                                 <PatternLayout
> pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n" />
>
>                                 </Console>
>
>                 </Appenders>
>
>
>
>                 <Loggers>
>
>                                 <Logger name="summit.feserver"
> level="info" additivity="false">
>
>                                                 <appender-ref
> ref="FTDailyFileAppender" level="info" />
>
>                                 </Logger>
>
>
>
>                                 <Root level="info" additivity="false">
>
>                                                 <appender-ref
> ref="console" />
>
>                                 </Root>
>
>                 </Loggers>
>
>
>
> </Configuration>
>
>
>
>
>
> Please find the logs
>
>
>
> 16-Aug-2017 18:08:51.272 INFO [localhost-startStop-1]
> org.apache.catalina.startup.HostConfig.deployWAR Deploying web
> application archive [D:\soft\apache-tomcat-8.5.20\
> webapps\ft_middle_ws.war]
>
> 16-Aug-2017 18:08:53.202 INFO [localhost-startStop-1]
> org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was
> scanned for TLDs yet contained no TLDs. Enable debug logging for this
> logger for a complete list of JARs that were scanned but no TLDs were found
> in them. Skipping unneeded JARs during scanning can improve startup time
> and JSP compilation time.
>
> DEBUG StatusLogger Loaded Provider Provider[priority=10,
> className=org.apache.logging.log4j.core.impl.Log4jContextFactory,
> url=jar:file:/D:/soft/apache-tomcat-8.5.20/webapps/ft_
> middle_ws/WEB-INF/lib/log4j-core-2.8.2.jar!/META-INF/log4j-provider.properties,
> classLoader=ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> ]
>
> DEBUG StatusLogger Using ShutdownCallbackRegistry class
> org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry
>
> DEBUG StatusLogger Took 0.115174 seconds to load 200 plugins from
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
>
>
> DEBUG StatusLogger PluginManager 'Converter' found 41 plugins
>
> DEBUG StatusLogger Jansi is not installed, cannot find
> org.fusesource.jansi.WindowsAnsiOutputStream
>
> DEBUG StatusLogger Starting OutputStreamManager SYSTEM_OUT.false.false-1
>
> DEBUG StatusLogger Starting LoggerContext[name=4115ca21,
> org.apache.logging.log4j.core.LoggerContext@66327786]...
>
> DEBUG StatusLogger Reconfiguration started for context[name=4115ca21] at
> URI null (org.apache.logging.log4j.core.LoggerContext@66327786) with
> optional
>
> ClassLoader: null
>
> DEBUG StatusLogger PluginManager 'ConfigurationFactory' found 4 plugins
>
> DEBUG StatusLogger Missing dependencies for Yaml support
>
> DEBUG StatusLogger Missing dependencies for Json support
>
> DEBUG StatusLogger Using configurationFactory
> org.apache.logging.log4j.core.config.ConfigurationFactory$Factory@59c2c435
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.properties] using
> context class loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.properties] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.properties] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.properties] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.yml] using context
> class loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.yml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.yml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.yml] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.yaml] using context
> class loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.yaml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.yaml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.yaml] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.json] using context
> class loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.json] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.json] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.json] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.jsn] using context
> class loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.jsn] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.jsn] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.jsn] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.xml] using context
> class loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.xml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.xml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.xml] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2-test.properties] using context
> class loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test.properties] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test.properties] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> 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 ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test.yml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test.yml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> 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 ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test.yaml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test.yaml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> 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 ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test.json] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test.json] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> 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 ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test.jsn] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test.jsn] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> 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 ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test.xml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test.xml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2-test.xml] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j24115ca21.properties] using
> context class loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j24115ca21.properties] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.properties] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.properties] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j24115ca21.yml] using context class
> loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j24115ca21.yml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.yml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.yml] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j24115ca21.yaml] using context
> class loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j24115ca21.yaml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.yaml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.yaml] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j24115ca21.json] using context
> class loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j24115ca21.json] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.json] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.json] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j24115ca21.jsn] using context class
> loader ParallelWebappClassLoader
>
>  context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j24115ca21.jsn] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.jsn] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.jsn] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j24115ca21.xml] using context class
> loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j24115ca21.xml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.xml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j24115ca21.xml] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2.properties] using context class
> loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2.properties] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.properties] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.properties] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2.yml] using context class loader
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2.yml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.yml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.yml] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2.yaml] using context class loader
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2.yaml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.yaml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.yaml] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2.json] using context class loader
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2.json] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.json] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.json] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2.jsn] using context class loader
> ParallelWebappClassLoader
>
>  context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2.jsn] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.jsn] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.jsn] using
> ClassLoader.getSystemResource().
>
> TRACE StatusLogger Trying to find [log4j2.xml] using context class loader
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2.xml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.xml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.xml] using
> ClassLoader.getSystemResource().
>
> ERROR StatusLogger No log4j2 configuration file found. Using default
> configuration: logging only errors to the console. Set system property
> 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show
> Log4j2 internal initialization logging.
>
> DEBUG StatusLogger PluginManager 'Converter' found 41 plugins
>
> DEBUG StatusLogger Jansi is not installed, cannot find
> org.fusesource.jansi.WindowsAnsiOutputStream
>
> DEBUG StatusLogger Starting OutputStreamManager SYSTEM_OUT.false.false-2
>
> DEBUG StatusLogger Initializing configuration
> org.apache.logging.log4j.core.config.DefaultConfiguration@69c77a4a
>
> DEBUG StatusLogger Installed script engines
>
> DEBUG StatusLogger Oracle Nashorn Version: 1.8.0_65, Language: ECMAScript,
> Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js,
> JS, JavaScript, javascript, ECMAScript, ecmascript}
>
> DEBUG StatusLogger PluginManager 'Core' found 113 plugins
>
> DEBUG StatusLogger PluginManager 'Level' found 0 plugins
>
> DEBUG StatusLogger Configuration org.apache.logging.log4j.core.
> config.DefaultConfiguration@69c77a4a initialized
>
> DEBUG StatusLogger Starting configuration org.apache.logging.log4j.core.
> config.DefaultConfiguration@69c77a4a
>
> DEBUG StatusLogger Started configuration org.apache.logging.log4j.core.
> config.DefaultConfiguration@69c77a4a OK.
>
> TRACE StatusLogger Stopping org.apache.logging.log4j.core.
> config.DefaultConfiguration@769a518a...
>
> TRACE StatusLogger DefaultConfiguration notified 1 ReliabilityStrategies
> that config will be stopped.
>
> TRACE StatusLogger DefaultConfiguration stopping root LoggerConfig.
>
> TRACE StatusLogger DefaultConfiguration notifying ReliabilityStrategies
> that appenders will be stopped.
>
> TRACE StatusLogger DefaultConfiguration stopping remaining Appenders.
>
> DEBUG StatusLogger Shutting down OutputStreamManager
> SYSTEM_OUT.false.false-1
>
> DEBUG StatusLogger Shut down OutputStreamManager SYSTEM_OUT.false.false-1,
> all resources released: true
>
> DEBUG StatusLogger Appender DefaultConsole-1 stopped with status true
>
> TRACE StatusLogger DefaultConfiguration stopped 1 remaining Appenders.
>
> TRACE StatusLogger DefaultConfiguration cleaning Appenders from 1
> LoggerConfigs.
>
> DEBUG StatusLogger Stopped org.apache.logging.log4j.core.
> config.DefaultConfiguration@769a518a OK
>
> TRACE StatusLogger Reregistering MBeans after reconfigure.
> Selector=org.apache.logging.log4j.core.selector.
> ClassLoaderContextSelector@7b8e4405
>
> TRACE StatusLogger Reregistering context (1/1): '4115ca21'
> org.apache.logging.log4j.core.LoggerContext@66327786
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=StatusLogger'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=ContextSelector'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=Loggers,name=*'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=Appenders,name=*'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=AsyncAppenders,name=*'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=AsyncLoggerRingBuffer'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=Loggers,name=*,subtype=
> RingBuffer'
>
> DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:
> type=4115ca21
>
> >>>>>>>>>>>>>>>>>Starting the servlet context
>
> >>>>>>>>>>>Set System property FT log dir: D:\soft\apache-tomcat-8.5.20\
> webapps\ft_middle_ws\\WEB-INF/log
>
> >>>>>>>>>>>>>>Set the log config file to file:/D:/soft/apache-tomcat-8.
> 5.20/webapps/ft_middle_ws/WEB-INF/log.xml
>
> >>>>>>>>>>>>>Inited the log
>
> >>>>>>>>>>>>>>Finished configuring log4j. The configuration file is:
> file:/D:/soft/apache-tomcat-8.5.20/webapps/ft_middle_ws/WEB-
> INF/log4j2.xmlsummit.feserver.ContextListener
>
> The configuration details are:
>
> [appender : {FTDailyFileAppender=FTDailyFileAppender, console=console}]
>
> [loggers : {=root, summit.feserver=summit.feserver}]
>
> SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
>
> SLF4J: Defaulting to no-operation (NOP) logger implementation
>
> SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
> details.
>
> 16-Aug-2017 18:08:54.536 INFO [localhost-startStop-1]
> org.apache.catalina.startup.HostConfig.deployWAR Deployment of web
> application archive [D:\soft\apache-tomcat-8.5.20\webapps\ft_middle_ws.war]
> has finished in [3,263] ms
>
>
>
> Q1. Is isLog4jAutoInitializationDisabled ignored? I see the log4j2
> framework is starting before calling the servlet context and fails. Please
> note I also tried with the listeners servlet context like
>
>     <listener>
>
>         <listener-class>summit.feserver.ContextListener</listener-class>
>
>     </listener>
>
>
>
>     <listener>
>
>         <listener-class>org.apache.logging.log4j.web.
> Log4jServletContextListener</listener-class>
>
>     </listener>
>
>     <filter>
>
>         <filter-name>log4jServletFilter</filter-name>
>
>         <filter-class>org.apache.logging.log4j.web.
> Log4jServletFilter</filter-class>
>
>     </filter>
>
>     <filter-mapping>
>
>         <filter-name>log4jServletFilter</filter-name>
>
>         <url-pattern>/*</url-pattern>
>
>         <dispatcher>REQUEST</dispatcher>
>
>         <dispatcher>FORWARD</dispatcher>
>
>         <dispatcher>INCLUDE</dispatcher>
>
>         <dispatcher>ERROR</dispatcher>
>
>         <dispatcher>ASYNC</dispatcher><!-- Servlet 3.0 w/ disabled
> auto-initialization only; not supported in 2.5 -->
>
>     </filter-mapping>
>
> I say it looks ignored as I see the debugging starting before I have a
> chance to do something in web app.
>
>
>
> Q2. How come the log4j2 get eventually configured? I have basically the
> code
>
> *public void *contextInitialized(ServletContextEvent arg0)
> {
>     System.*out*.println(*">>>>>>>>>>>>>>>>>Starting the servlet context"*);
>     *_ctx *= arg0.getServletContext();
>
> […]
>
> System.*setProperty*( *"FTMIDDLE_LOGDIR"*, fullPathLogDir );
> System.*out*.println(*">>>>>>>>>>>Set System property FT log dir: " *+ 
> fullPathLogDir);
>
> StringBuilder pathToConfigFile = *new *StringBuilder().append(path).
> append(log4jConfig);
> *_ctx*.setInitParameter(Log4jWebSupport.*LOG4J_CONFIG_LOCATION*,
>         *new *File(pathToConfigFile.toString()).toURI().toString());
> System.*out*.println(*">>>>>>>>>>>>>>Set the log config file to " *+ *new
> *File(pathToConfigFile.toString()).toURI().toString());
> *listener*.contextInitialized(arg0);
> System.*out*.println(*">>>>>>>>>>>>>Inited the log"*);
> Configuration log4jConfiguration = LoggerContext.*getContext*().
> getConfiguration();
> System.*out*.println(
> *">>>>>>>>>>>>>>Finished configuring log4j. The configuration file is: "
>         *+ LoggerContext.*getContext*().getConfigLocation()
>         + *"**\n**The configuration details are: **\n*
> *[appender : "         *+ log4jConfiguration.getAppenders().toString() +
> *"]"         *+ *"**\n**[loggers : " *+ 
> log4jConfiguration.getLoggers().toString()
> + *"]"*);
>
> And although initially the logger framework seems to fail
>
>
>
> ERROR StatusLogger No log4j2 configuration file found. Using default
> configuration: logging only errors to the console. Set system property
> 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show
> Log4j2 internal initialization logging.
>
>
>
> In the end actually everything is fine. Not only the logger context
> correctly reports the location of configuration file, but also it was
> capable of loading correctly the appenders and so it understood the system
> var.
>
>
>
> Q3. What is changing once I add the log4j2 listener before servlet context
> listener? The result is basically the same, but the logs are changing
> slightly
>
>
>
> 17-Aug-2017 17:16:05.775 INFO [localhost-startStop-1]
> org.apache.catalina.startup.HostConfig.deployWAR Deploying web
> application archive [D:\soft\apac
>
> he-tomcat-8.5.20\webapps\ft_middle_ws.war]
>
> 17-Aug-2017 17:16:07.455 INFO [localhost-startStop-1]
> org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was
> scanned for TLDs yet containe
>
> d no TLDs. Enable debug logging for this logger for a complete list of
> JARs that were scanned but no TLDs were found in them. Skipping unneeded
> JARs d
>
> uring scanning can improve startup time and JSP compilation time.
>
> DEBUG StatusLogger Loaded Provider Provider[priority=10,
> className=org.apache.logging.log4j.core.impl.Log4jContextFactory,
> url=jar:file:/D:/soft/apache-tomcat-8.5.20/webapps/ft_
> middle_ws/WEB-INF/lib/log4j-core-2.8.2.jar!/META-INF/log4j-provider.properties,
> classLoader=ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> ]
>
> DEBUG StatusLogger Using ShutdownCallbackRegistry class
> org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry
>
> DEBUG StatusLogger Took 0.106548 seconds to load 200 plugins from
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
>
>
> DEBUG StatusLogger PluginManager 'Converter' found 41 plugins
>
> DEBUG StatusLogger Jansi is not installed, cannot find
> org.fusesource.jansi.WindowsAnsiOutputStream
>
> DEBUG StatusLogger Starting OutputStreamManager SYSTEM_OUT.false.false-1
>
> DEBUG StatusLogger Starting LoggerContext[name=4115ca21,
> org.apache.logging.log4j.core.LoggerContext@2c1c3677]...
>
> DEBUG StatusLogger Reconfiguration started for context[name=4115ca21] at
> URI null (org.apache.logging.log4j.core.LoggerContext@2c1c3677) with
> optional
>
> ClassLoader: null
>
> DEBUG StatusLogger PluginManager 'ConfigurationFactory' found 4 plugins
>
> DEBUG StatusLogger Missing dependencies for Yaml support
>
> DEBUG StatusLogger Missing dependencies for Json support
>
> DEBUG StatusLogger Using configurationFactory
> org.apache.logging.log4j.core.config.ConfigurationFactory$Factory@2e21e291
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.properties] using
> context class loader ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> .
>
> TRACE StatusLogger Trying to find [log4j2-test4115ca21.properties] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> […]
>
> TRACE StatusLogger Trying to find [log4j2.xml] using
> ParallelWebappClassLoader
>
>   context: ft_middle_ws
>
>   delegate: false
>
> ----------> Parent Classloader:
>
> java.net.URLClassLoader@67b64c45
>
> class loader.
>
> TRACE StatusLogger Trying to find [log4j2.xml] using
> ClassLoader.getSystemResource().
>
> ERROR StatusLogger No log4j2 configuration file found. Using default
> configuration: logging only errors to the console. Set system property
> 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show
> Log4j2 internal initialization logging.
>
> DEBUG StatusLogger PluginManager 'Converter' found 41 plugins
>
> DEBUG StatusLogger Jansi is not installed, cannot find
> org.fusesource.jansi.WindowsAnsiOutputStream
>
> DEBUG StatusLogger Starting OutputStreamManager SYSTEM_OUT.false.false-2
>
> DEBUG StatusLogger Initializing configuration
> org.apache.logging.log4j.core.config.DefaultConfiguration@78c8d24a
>
> DEBUG StatusLogger Installed script engines
>
> DEBUG StatusLogger Oracle Nashorn Version: 1.8.0_65, Language: ECMAScript,
> Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js,
> JS, JavaScript, javascript, ECMAScript, ecmascript}
>
> DEBUG StatusLogger PluginManager 'Core' found 113 plugins
>
> DEBUG StatusLogger PluginManager 'Level' found 0 plugins
>
> DEBUG StatusLogger Configuration org.apache.logging.log4j.core.
> config.DefaultConfiguration@78c8d24a initialized
>
> DEBUG StatusLogger Starting configuration org.apache.logging.log4j.core.
> config.DefaultConfiguration@78c8d24a
>
> DEBUG StatusLogger Started configuration org.apache.logging.log4j.core.
> config.DefaultConfiguration@78c8d24a OK.
>
> TRACE StatusLogger Stopping org.apache.logging.log4j.core.
> config.DefaultConfiguration@11fe5676...
>
> TRACE StatusLogger DefaultConfiguration notified 1 ReliabilityStrategies
> that config will be stopped.
>
> TRACE StatusLogger DefaultConfiguration stopping root LoggerConfig.
>
> TRACE StatusLogger DefaultConfiguration notifying ReliabilityStrategies
> that appenders will be stopped.
>
> TRACE StatusLogger DefaultConfiguration stopping remaining Appenders.
>
> DEBUG StatusLogger Shutting down OutputStreamManager
> SYSTEM_OUT.false.false-1
>
> DEBUG StatusLogger Shut down OutputStreamManager SYSTEM_OUT.false.false-1,
> all resources released: true
>
> DEBUG StatusLogger Appender DefaultConsole-1 stopped with status true
>
> TRACE StatusLogger DefaultConfiguration stopped 1 remaining Appenders.
>
> TRACE StatusLogger DefaultConfiguration cleaning Appenders from 1
> LoggerConfigs.
>
> DEBUG StatusLogger Stopped org.apache.logging.log4j.core.
> config.DefaultConfiguration@11fe5676 OK
>
> TRACE StatusLogger Reregistering MBeans after reconfigure.
> Selector=org.apache.logging.log4j.core.selector.
> ClassLoaderContextSelector@47de05bb
>
> TRACE StatusLogger Reregistering context (1/1): '4115ca21'
> org.apache.logging.log4j.core.LoggerContext@2c1c3677
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=StatusLogger'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=ContextSelector'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=Loggers,name=*'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=Appenders,name=*'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=AsyncAppenders,name=*'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=AsyncLoggerRingBuffer'
>
> TRACE StatusLogger Unregistering but no MBeans found matching
> 'org.apache.logging.log4j2:type=4115ca21,component=Loggers,name=*,subtype=
> RingBuffer'
>
> DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:
> type=4115ca21
>
> 2017-08-17 17:16:08,359 localhost-startStop-1 ERROR Unable to create file
> ${sys:FTMIDDLE_LOGDIR}/FTMiddle.log java.io.IOException: The filename,
> direc
>
> tory name, or volume label syntax is incorrect
>
>         at java.io.WinNTFileSystem.canonicalize0(Native Method)
>
>         at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:428)
>
>         at java.io.File.getCanonicalPath(File.java:618)
>
>         at java.io.File.getCanonicalFile(File.java:643)
>
>         at org.apache.logging.log4j.core.util.FileUtils.makeParentDirs(
> FileUtils.java:134)
>
>         at org.apache.logging.log4j.core.appender.rolling.
> RollingFileManager$RollingFileManagerFactory.createManager(
> RollingFileManager.java:573)
>
>         at org.apache.logging.log4j.core.appender.rolling.
> RollingFileManager$RollingFileManagerFactory.createManager(
> RollingFileManager.java:554)
>
>         at org.apache.logging.log4j.core.appender.AbstractManager.
> getManager(AbstractManager.java:112)
>
>         at org.apache.logging.log4j.core.appender.OutputStreamManager.
> getManager(OutputStreamManager.java:114)
>
>         at org.apache.logging.log4j.core.appender.rolling.
> RollingFileManager.getFileManager(RollingFileManager.java:155)
>
>         at org.apache.logging.log4j.core.appender.RollingFileAppender$
> Builder.build(RollingFileAppender.java:131)
>
>         at org.apache.logging.log4j.core.appender.RollingFileAppender$
> Builder.build(RollingFileAppender.java:60)
>
>         at org.apache.logging.log4j.core.config.plugins.util.
> PluginBuilder.build(PluginBuilder.java:122)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> createPluginObject(AbstractConfiguration.java:952)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> createConfiguration(AbstractConfiguration.java:892)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> createConfiguration(AbstractConfiguration.java:884)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> doConfigure(AbstractConfiguration.java:508)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> initialize(AbstractConfiguration.java:232)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> start(AbstractConfiguration.java:244)
>
>         at org.apache.logging.log4j.core.LoggerContext.setConfiguration(
> LoggerContext.java:545)
>
>         at org.apache.logging.log4j.core.LoggerContext.reconfigure(
> LoggerContext.java:617)
>
>         at org.apache.logging.log4j.core.LoggerContext.setConfigLocation(
> LoggerContext.java:603)
>
>         at org.apache.logging.log4j.core.selector.
> ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.
> java:157)
>
>         at org.apache.logging.log4j.core.selector.
> ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:70)
>
>         at org.apache.logging.log4j.core.impl.Log4jContextFactory.
> getContext(Log4jContextFactory.java:227)
>
>         at org.apache.logging.log4j.core.config.Configurator.
> initialize(Configurator.java:159)
>
>         at org.apache.logging.log4j.web.Log4jWebInitializerImpl.
> initializeNonJndi(Log4jWebInitializerImpl.java:168)
>
>         at org.apache.logging.log4j.web.Log4jWebInitializerImpl.start(
> Log4jWebInitializerImpl.java:110)
>
>         at org.apache.logging.log4j.web.Log4jServletContextListener.
> contextInitialized(Log4jServletContextListener.java:56)
>
>         at org.apache.catalina.core.StandardContext.listenerStart(
> StandardContext.java:4745)
>
>         at org.apache.catalina.core.StandardContext.startInternal(
> StandardContext.java:5207)
>
>         at org.apache.catalina.util.LifecycleBase.start(
> LifecycleBase.java:150)
>
>         at org.apache.catalina.core.ContainerBase.addChildInternal(
> ContainerBase.java:752)
>
>         at org.apache.catalina.core.ContainerBase.addChild(
> ContainerBase.java:728)
>
>         at org.apache.catalina.core.StandardHost.addChild(
> StandardHost.java:734)
>
>         at org.apache.catalina.startup.HostConfig.deployWAR(
> HostConfig.java:988)
>
>         at org.apache.catalina.startup.HostConfig$DeployWar.run(
> HostConfig.java:1860)
>
>         at java.util.concurrent.Executors$RunnableAdapter.
> call(Executors.java:511)
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)
>
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)
>
>         at java.lang.Thread.run(Thread.java:745)
>
>
>
> 2017-08-17 17:16:08,363 localhost-startStop-1 ERROR Unable to inject
> fields into builder class for plugin type class
> org.apache.logging.log4j.core.appender.RollingFileAppender, element
> RollingFile. java.lang.IllegalStateException: ManagerFactory
> [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$
> RollingFileManagerFactory@5a7def29] unable to create manager for
> [${sys:FTMIDDLE_LOGDIR}/FTMiddle.log] with data [org.apache.logging.log4j.
> core.appender.rolling.RollingFileManager$FactoryData@10285321[pattern=$
> {sys:FTMIDDLE_LOGDIR}/FTMiddle-%d{yyyy-MM-dd}.log, append=true,
> bufferedIO=true, bufferSize=8192, policy=CompositeTriggeringPolicy(
> policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1,
> modulate=true)]), strategy=DefaultRolloverStrategy(min=1, max=7,
> useMax=true), advertiseURI=null, layout=[%-5level] %d{yyyy-MM-dd
> HH:mm:ss.SSS} [%t] %c{1} - %msg%n]]
>
>         at org.apache.logging.log4j.core.appender.AbstractManager.
> getManager(AbstractManager.java:114)
>
>         at org.apache.logging.log4j.core.appender.OutputStreamManager.
> getManager(OutputStreamManager.java:114)
>
>         at org.apache.logging.log4j.core.appender.rolling.
> RollingFileManager.getFileManager(RollingFileManager.java:155)
>
>         at org.apache.logging.log4j.core.appender.RollingFileAppender$
> Builder.build(RollingFileAppender.java:131)
>
>         at org.apache.logging.log4j.core.appender.RollingFileAppender$
> Builder.build(RollingFileAppender.java:60)
>
>         at org.apache.logging.log4j.core.config.plugins.util.
> PluginBuilder.build(PluginBuilder.java:122)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> createPluginObject(AbstractConfiguration.java:952)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> createConfiguration(AbstractConfiguration.java:892)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> createConfiguration(AbstractConfiguration.java:884)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> doConfigure(AbstractConfiguration.java:508)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> initialize(AbstractConfiguration.java:232)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> start(AbstractConfiguration.java:244)
>
>         at org.apache.logging.log4j.core.LoggerContext.setConfiguration(
> LoggerContext.java:545)
>
>         at org.apache.logging.log4j.core.LoggerContext.reconfigure(
> LoggerContext.java:617)
>
>         at org.apache.logging.log4j.core.LoggerContext.setConfigLocation(
> LoggerContext.java:603)
>
>         at org.apache.logging.log4j.core.selector.
> ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.
> java:157)
>
>         at org.apache.logging.log4j.core.selector.
> ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:70)
>
>         at org.apache.logging.log4j.core.impl.Log4jContextFactory.
> getContext(Log4jContextFactory.java:227)
>
>         at org.apache.logging.log4j.core.config.Configurator.
> initialize(Configurator.java:159)
>
>         at org.apache.logging.log4j.web.Log4jWebInitializerImpl.
> initializeNonJndi(Log4jWebInitializerImpl.java:168)
>
>         at org.apache.logging.log4j.web.Log4jWebInitializerImpl.start(
> Log4jWebInitializerImpl.java:110)
>
>         at org.apache.logging.log4j.web.Log4jServletContextListener.
> contextInitialized(Log4jServletContextListener.java:56)
>
>         at org.apache.catalina.core.StandardContext.listenerStart(
> StandardContext.java:4745)
>
>         at org.apache.catalina.core.StandardContext.startInternal(
> StandardContext.java:5207)
>
>         at org.apache.catalina.util.LifecycleBase.start(
> LifecycleBase.java:150)
>
>         at org.apache.catalina.core.ContainerBase.addChildInternal(
> ContainerBase.java:752)
>
>         at org.apache.catalina.core.ContainerBase.addChild(
> ContainerBase.java:728)
>
>         at org.apache.catalina.core.StandardHost.addChild(
> StandardHost.java:734)
>
>         at org.apache.catalina.startup.HostConfig.deployWAR(
> HostConfig.java:988)
>
>         at org.apache.catalina.startup.HostConfig$DeployWar.run(
> HostConfig.java:1860)
>
>         at java.util.concurrent.Executors$RunnableAdapter.
> call(Executors.java:511)
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)
>
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)
>
>         at java.lang.Thread.run(Thread.java:745)
>
>
>
> 2017-08-17 17:16:08,371 localhost-startStop-1 ERROR Unable to invoke
> factory method in class class 
> org.apache.logging.log4j.core.appender.RollingFileAppender
> for element RollingFile. java.lang.IllegalStateException: No factory
> method found for class org.apache.logging.log4j.core.
> appender.RollingFileAppender
>
>         at org.apache.logging.log4j.core.config.plugins.util.
> PluginBuilder.findFactoryMethod(PluginBuilder.java:224)
>
>         at org.apache.logging.log4j.core.config.plugins.util.
> PluginBuilder.build(PluginBuilder.java:130)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> createPluginObject(AbstractConfiguration.java:952)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> createConfiguration(AbstractConfiguration.java:892)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> createConfiguration(AbstractConfiguration.java:884)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> doConfigure(AbstractConfiguration.java:508)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> initialize(AbstractConfiguration.java:232)
>
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.
> start(AbstractConfiguration.java:244)
>
>         at org.apache.logging.log4j.core.LoggerContext.setConfiguration(
> LoggerContext.java:545)
>
>         at org.apache.logging.log4j.core.LoggerContext.reconfigure(
> LoggerContext.java:617)
>
>         at org.apache.logging.log4j.core.LoggerContext.setConfigLocation(
> LoggerContext.java:603)
>
>         at org.apache.logging.log4j.core.selector.
> ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.
> java:157)
>
>         at org.apache.logging.log4j.core.selector.
> ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:70)
>
>         at org.apache.logging.log4j.core.impl.Log4jContextFactory.
> getContext(Log4jContextFactory.java:227)
>
>         at org.apache.logging.log4j.core.config.Configurator.
> initialize(Configurator.java:159)
>
>         at org.apache.logging.log4j.web.Log4jWebInitializerImpl.
> initializeNonJndi(Log4jWebInitializerImpl.java:168)
>
>         at org.apache.logging.log4j.web.Log4jWebInitializerImpl.start(
> Log4jWebInitializerImpl.java:110)
>
>         at org.apache.logging.log4j.web.Log4jServletContextListener.
> contextInitialized(Log4jServletContextListener.java:56)
>
>         at org.apache.catalina.core.StandardContext.listenerStart(
> StandardContext.java:4745)
>
>         at org.apache.catalina.core.StandardContext.startInternal(
> StandardContext.java:5207)
>
>         at org.apache.catalina.util.LifecycleBase.start(
> LifecycleBase.java:150)
>
>         at org.apache.catalina.core.ContainerBase.addChildInternal(
> ContainerBase.java:752)
>
>         at org.apache.catalina.core.ContainerBase.addChild(
> ContainerBase.java:728)
>
>         at org.apache.catalina.core.StandardHost.addChild(
> StandardHost.java:734)
>
>         at org.apache.catalina.startup.HostConfig.deployWAR(
> HostConfig.java:988)
>
>         at org.apache.catalina.startup.HostConfig$DeployWar.run(
> HostConfig.java:1860)
>
>         at java.util.concurrent.Executors$RunnableAdapter.
> call(Executors.java:511)
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)
>
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)
>
>         at java.lang.Thread.run(Thread.java:745)
>
>
>
> 2017-08-17 17:16:08,382 localhost-startStop-1 ERROR Null object returned
> for RollingFile in Appenders.
>
> 2017-08-17 17:16:08,387 localhost-startStop-1 ERROR Unable to locate
> appender "FTDailyFileAppender" for logger config "summit.feserver"
>
> >>>>>>>>>>>>>>>>>Starting the servlet context
>
> …
>
> I mean, how come it doesn’t find the config file (still the ERROR
>
> ERROR StatusLogger No log4j2 configuration file found. Using default
> configuration: logging only errors to the console. Set system property
> 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show
> Log4j2 internal initialization logging.
>
> ) but it reads the file, is senses the missing system var, and in the end,
> again it is fine of loading it?
>
>
>
> Q4. Why it is locking the config file? In order to get rid of the ERROR
>
> ERROR StatusLogger No log4j2 configuration file found. Using default
> configuration: logging only errors to the console. Set system property
> 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show
> Log4j2 internal initialization logging.
>
> a dummy config file is stored in the classes directory. No error, log gets
> eventually configured through the servlet context, all fine. But on deploy,
> the respective dummy config file remains locked and can’t be deteled by
> tomcat, so no undeploy.
>
> Yes, I have in close
>
> *public void *contextDestroyed(ServletContextEvent arg0)
> {
>     org.apache.logging.log4j.LogManager.*shutdown*();
> }
>
>
>
> All these question can be ignored if you could tell me how can I
> programmatically set an env var before log4j2 reads the config file,
> running in webapp in tomcat. No, I can’t provide it through the tomcat
> startup command line. No, I can’t set it before JVM of tomcat starts. I
> have to compute it in tomcat before setting it. And no, I can’t provide it
> through a custom map, because I need to read the servlet config params
> before. Build system is Ant based, not sure if I can use for instance
> @Plugin.
>
>
>
>
>
> Yours sincerely,
>
> *Radu Darlea*
> Development Manager,
>
> FusionCapital Summit
> <http://www.misys.com/solutions/fusioncapital/fusioncapital-summit/>
>
>
>
> [image: FINASTRA]
>
>
>
> *Finastra* Splaiul Independentei Street, No 319, Sema Parc, Courtyard 1
> Building, Floor 3, Bucharest, Romania
> *D:* +(40)3 1712 2912 | *M:* + (40)7405 71909 | *E*: 22912
>
> radu.dar...@finastra.com
>
> *Finastra.com <http://www.finastra.com/>*
>
>
>
>
> "FINASTRA" is the trade name of the FINASTRA group of companies. This
> email and any attachments have been scanned for known viruses using
> multiple scanners. This email message is intended for the named recipient
> only. It may be privileged and/or confidential. If you are not the named
> recipient of this email please notify us immediately and do not copy it or
> use it for any purpose, nor disclose its contents to any other person. This
> email does not constitute the commencement of legal relations between you
> and FINASTRA. Please refer to the executed contract between you and the
> relevant member of the FINASTRA group for the identity of the contracting
> party with which you are dealing.
>

Reply via email to