AW: log4j2 configuration in Tomcat 8.5.8

2016-12-05 Thread Frank.Pientka
OK Rainer i moved log4j-core-2.6.2.jar, log4j-api-2.6.2.jar, 
log4j-jul-2.6.2.jar and log4j2.xml to $CATALINA_HOME/bin
Then changed
set 
JAVA_OPTS=-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
set LOGGING_CONFIG=-DnoOpp
set 
LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
set 
"CLASSPATH=.;%CATALINA_BASE%\bin;%CATALINA_BASE%\bin\log4j-core-2.6.2.jar;%CATALINA_BASE%\bin\log4j-api-2.6.2.jar;%CATALINA_BASE%\bin\log4j-jul-2.6.2.jar"
then all woked fine THX frank

-Ursprüngliche Nachricht-
Von: Rainer Jung [mailto:rainer.j...@kippdata.de] 
Gesendet: Montag, 5. Dezember 2016 12:28
An: Tomcat Users List <users@tomcat.apache.org>
Betreff: Re: log4j2 configuration in Tomcat 8.5.8

Am 05.12.2016 um 08:32 schrieb frank.pien...@materna.de:
> It's a little bit frustrating to configure Tomcat 8.5.8 with log4j2.
> I put the following jars in $CATALINA_HOME/lib
> log4j 2 core (log4j-core-2.6.2.jar)
> log4j 2 api (log4j-api-2.6.2.jar) Delete the file 
> $CATALINA_HOME/conf/logging.properties
> Put the new log4j 2 config file (log4j2.xml) in $CATALINA_HOME/lib 
>   name="catalina" packages="">
> 
>  
> 
> 
>  fileName="${catalina.base}/logs/catalina.log">
>   
> %d %p %c{1.} [%t] %m%n
>   
> 
> 
>   
>
> 
>   
> 
>   
>  
> 
>   
> 
> No errors but the created catalina.out file is empty and the console 
> layout doesn't change What else to check or change?
> THX Frank

Currently you need to put three log4j2 jar files into the CLASSPATH (not the 
lib directory):

- core
- api
- jul bridge

Next put your log4j2.xml in some special directory and add that directory to 
the CLASSPATH as well.

Since in 8.5 Log4J integration is via its jul bridge it must be loadable by 
jul, that's why CLASSPATH and not just the lib directory.

Finally add the following system property to inform jul that it should log via 
log4j2:

-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager

for instance by setting LOGGING_MANAGER to that value. To reduce confusion I 
suggest to also set LOGGING_CONFIG to some dummy value, e.g. 
-Dnop.

See:

http://logging.apache.org/log4j/2.x/log4j-jul/index.html

There is a (minor) flaw currently in this integration: the location info (class 
name, method name, line number) will be wrong and always point to a fixed 
position in Tomcat Juli instead of the "real" class calling the log method.

For more details about this problem see also:

http://marc.info/?t=14774015512=1=2

Regards,

Rainer

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: log4j2 configuration in Tomcat 8.5.8

2016-12-05 Thread Rainer Jung

Am 05.12.2016 um 08:32 schrieb frank.pien...@materna.de:

It's a little bit frustrating to configure Tomcat 8.5.8 with log4j2.
I put the following jars in $CATALINA_HOME/lib
log4j 2 core (log4j-core-2.6.2.jar)
log4j 2 api (log4j-api-2.6.2.jar)
Delete the file $CATALINA_HOME/conf/logging.properties
Put the new log4j 2 config file (log4j2.xml) in $CATALINA_HOME/lib



 



  
%d %p %c{1.} [%t] %m%n
  


  
   

  

  
 

  

No errors but the created catalina.out file is empty and the console layout 
doesn't change
What else to check or change?
THX Frank


Currently you need to put three log4j2 jar files into the CLASSPATH (not 
the lib directory):


- core
- api
- jul bridge

Next put your log4j2.xml in some special directory and add that 
directory to the CLASSPATH as well.


Since in 8.5 Log4J integration is via its jul bridge it must be loadable 
by jul, that's why CLASSPATH and not just the lib directory.


Finally add the following system property to inform jul that it should 
log via log4j2:


-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager

for instance by setting LOGGING_MANAGER to that value. To reduce 
confusion I suggest to also set LOGGING_CONFIG to some dummy value, e.g. 
-Dnop.


See:

http://logging.apache.org/log4j/2.x/log4j-jul/index.html

There is a (minor) flaw currently in this integration: the location info 
(class name, method name, line number) will be wrong and always point to 
a fixed position in Tomcat Juli instead of the "real" class calling the 
log method.


For more details about this problem see also:

http://marc.info/?t=14774015512=1=2

Regards,

Rainer

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



log4j2 configuration in Tomcat 8.5.8

2016-12-04 Thread Frank.Pientka
It's a little bit frustrating to configure Tomcat 8.5.8 with log4j2.
I put the following jars in $CATALINA_HOME/lib
log4j 2 core (log4j-core-2.6.2.jar)
log4j 2 api (log4j-api-2.6.2.jar)
Delete the file $CATALINA_HOME/conf/logging.properties
Put the new log4j 2 config file (log4j2.xml) in $CATALINA_HOME/lib



 



  
%d %p %c{1.} [%t] %m%n
  


  
   

  

  
 

  

No errors but the created catalina.out file is empty and the console layout 
doesn't change
What else to check or change?
THX Frank