[ 
https://issues.apache.org/jira/browse/LOG4J2-1499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nina Kumar updated LOG4J2-1499:
-------------------------------
    Description: 
App server - Weblogic 12c.
JDK-1.8
Servlet 3.0
deploy file - Enterprise Archive File (EAR)

ear
   lib
       jar1.jar
       jar2.jar
    war
       WEB-INF
           classes

We need log4j2.xml outside ear because we have to control log location and  
level for different env.

1. Web.xml is updated with log4j2.xml outside ear but in classpath. Logs are 
initialized on application start but only classes in war are only getting 
logged not ear/lib jars classes.

<listenerclass>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
<context-param>
                <param-name>log4jConfiguration</param-name>
                <param-value>config/myapp/myapp.log4j2.xml</param-value>
</context-param>

2.Since option 1 didn't work  I have set isLog4jAutoInitializationDisabled in 
web.xml so that I can initialize log4j within application. But it is not 
working. 
I expected log4j2 not initialize on start up. But still log4j started up before 
application gets started.

3. Logging is working only if I put Log4j2.xml(without filters) in war  
web-inf/classes.

4. If I put filters like below in web-inf/classes/log4j2.xml log4j throw error 
in adminserver.log

Below configuration filters causing problem on Log4j Initialization at start 
up. The value will get loaded only after application starts.

<Property name="LOG_LOCATION">$${sys:log4j.log.location}</Property>
 <Property name="LOG_LEVEL">$${sys:log4j.log.level}</Property>

I want option 1 to work. I tried all others because option 1 didn't work.

  was:
App server - Weblogic 12c.
JDK-1.8
Servlet 3.0
deploy file - Enterprise Archive File (EAR)

ear
   lib
       jar1.jar
       jar2.jar
    war
       WEB-INF
           classes

We need log4j2.xml outside ear because we have to control log location and  
level for different env.

1. Web.xml is updated with log4j2.xml outside ear but in classpath. Logs are 
initialized on application start but only classes in war are only getting 
logged not ear/lib jars classes.

<listenerclass>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
<context-param>
                <param-name>log4jConfiguration</param-name>
                <param-value>config/myapp/myapp.log4j2.xml</param-value>
</context-param>

2. I have  set  isLog4jAutoInitializationDisabled in web.xml so that I can 
initialize log4j within application. But it is not working. 
I expected log4j2 not initialize on start up. But still log4j started up before 
application gets started.

3. Logging is working only if I put Log4j2.xml(without filters) in war  
web-inf/classes.

4. If I put filters like below in web-inf/classes/log4j2.xml log4j throw error 
in adminserver.log

Below configuration filters causing problem on Log4j Initialization at start 
up. The value will get loaded only after application starts.

<Property name="LOG_LOCATION">$${sys:log4j.log.location}</Property>
 <Property name="LOG_LEVEL">$${sys:log4j.log.level}</Property>

I want option 1 to work. I tried all others because option 1 didn't work.


> Logging not working for EAR applications
> ----------------------------------------
>
>                 Key: LOG4J2-1499
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1499
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.6.2
>            Reporter: Nina Kumar
>
> App server - Weblogic 12c.
> JDK-1.8
> Servlet 3.0
> deploy file - Enterprise Archive File (EAR)
> ear
>    lib
>        jar1.jar
>        jar2.jar
>     war
>        WEB-INF
>            classes
> We need log4j2.xml outside ear because we have to control log location and  
> level for different env.
> 1. Web.xml is updated with log4j2.xml outside ear but in classpath. Logs are 
> initialized on application start but only classes in war are only getting 
> logged not ear/lib jars classes.
> <listenerclass>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
> <context-param>
>               <param-name>log4jConfiguration</param-name>
>               <param-value>config/myapp/myapp.log4j2.xml</param-value>
> </context-param>
> 2.Since option 1 didn't work  I have set isLog4jAutoInitializationDisabled in 
> web.xml so that I can initialize log4j within application. But it is not 
> working. 
> I expected log4j2 not initialize on start up. But still log4j started up 
> before application gets started.
> 3. Logging is working only if I put Log4j2.xml(without filters) in war  
> web-inf/classes.
> 4. If I put filters like below in web-inf/classes/log4j2.xml log4j throw 
> error in adminserver.log
> Below configuration filters causing problem on Log4j Initialization at start 
> up. The value will get loaded only after application starts.
> <Property name="LOG_LOCATION">$${sys:log4j.log.location}</Property>
>  <Property name="LOG_LEVEL">$${sys:log4j.log.level}</Property>
> I want option 1 to work. I tried all others because option 1 didn't work.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to