I have a very frozen and stable tomcat 7.0.68 system with a lot of apps.
It was build from source and uses the extras tomcat-juli.jar with
log4j-1.2.17.jar.
Both tomcat and my webapps log successfully via log4j (except, of
course, the access log valve).
The time has come to bring the whole system up to date, but I don't want
to jump too far in a single leap, so I am trying to port the production
environment to a new server image. (The old system is ubuntu 16.04.6 LTS
32-bit. The new system is 18.04.3 LTS 64-bit).
I have read (very carefully) the tomcat8 logging.html,
extras.html#Full_commons-logging_implementation and
class-loader-howto.html. I am aware of
https://bz.apache.org/bugzilla/show_bug.cgi?id=58588. They have confused
me, even though I've read them a lot in the past!
I have built tomcat 8.5.53-dev under OpenJDK 1.8.0_232 (64 bit), and
also the extras. tomcat also executes under jdk8.
Extras no longer builds the full logging jar, so I am apparently forced
to use the tomcat-juli.jar from the main build. log4j has moved from
version 1 to 2, with quite a few changes, so I decided to implement
log4j2 right from the start.
To simplify my conversion effort, I decided to get tomcat itself logging
via laog4j2 before I converted any of the webapps. That has been a
frustrating and unsuccessful task so far!
I can confirm the experience of others - unless tomcat-juli.jar is in
the same directory as bootstrap.jar (catalina.home/bin), startup fails
with ClassNotFoundException.
I do NOT have a logging.properties file in conf.
catalina.base/lib has my log4j2.xml, along with log4j-api.jar,
log4j-core.jar and log4j-jul.jar. I have tried them in a lot of places,
including catalina.home/bin, catalina.base/system, common and server,
but nothing seems to improve.
/var/log/tc8/catalina.out reports (apologies for nasty line breaks):
Mar 17, 2020 8:45:34 AM
org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument:
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
But there are no initialisation messages from log4j2.
The log4j2 Root Logger has AppenderRef to a RollingFileAppender with
fileName="${logdir}/catalina.log" (where logdir resolves to
/var/log/tomcat/).
I am not convinced catalina.out is being handled by log4j2 at all!
I would be very grateful for any advice to make my tomcat8 use log4j2. I
hope this advice will permit me to recommend some improvements to the
relevant pages of the tomcat wiki...
Thanks in anticipation,
Brian
(back on the list after nearly 4 years away!)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org