From this article, to enable the Log4j 1.2 bridge, you should
But how to set the system property if my class is running under Tomcat 8.5?
First you need to understand what is a system property. Check this
Then, if your concern is just how to add a system property on tomcat like classic ram increment, you just need to add key=value
to the JAVA_OPTS
or CATALINA_OPTS
on some script of tomcat:
-Dlog4j1.compatibility=true
If you don't want to change some default tomcat file, you could create the setenv.sh
in the bin folder and add something like this:
#!/bin/sh
MIN_MEMORY="384m"
MAX_MEMORY="768m"
LOG4J_BRIDGE="-Dlog4j1.compatibility=true"
JAVA_OPTS="-Xms${MIN_MEMORY} -Xmx${MAX_MEMORY} ${LOG4J_BRIDGE} ${JAVA_OPTS}"
Basically tomcat say us: If you want to add, change or override special tomcat settings, add them in the file setenv.sh
and I will load that vars before the startup.
Here are some setenv.sh
examples to see more special java/tomcat system properties and environment variables: