Unlike the Tomcat 8.0 series, the 8.5 series log output has some changes.
This time I will replace it with Log4j2, but with Log4j2.4 and earlier methods, it will be ** ignored ** at all.
The procedure is as follows:
Download the set of log4j2 from https://logging.apache.org/log4j/2.x/download.html → unzip it. Next, put the jar file that can be eaten as the standard log adapter of Tomcat and the jar of Log4J2 main body to lib of the Tomcat8.5 installation directory (hereinafter referred to as CATALINA_HOME defined in the environment variable following the Tomcat startup bat | sh file). Place the following three.
Create a Log4j2 configuration file (usually log4j2.xml) and place it. You can place it anywhere, but for the sake of clarity, place it in CATALINA_HOME / conf.
For a setting example of log4j2.xml, see Qiita: Steps to replace Tomcat log output with log4j2. Let's make appropriate adjustments.
The Tomcat startup files startup.bat and startup.sh are defined to execute setenv.bat and setenv.sh, which can define environment variables, so create these files **.
For Windows, write the following line
setenv.bat
SET JAVA_OPTS=%JAVA_OPTS% -Dlog4j.configurationFile=file://%CATALINA_HOME%/conf/log4j2.xml
That is all for the setting items. When you execute startup.bat or startup.sh, it will be output from Log4j2 safely.
Until Tomcat8.0 series, it was necessary to delete logging.properties in CATALINA_HOME / conf or save it to another location and download the adapter for log output separately, but these operations are no longer necessary. .. Rather ** Don't do ** (because log settings are ignored altogether)
Procedure to replace tomcat log output with log4j2 Log4J|Commons Logging Bridge http://tomcat.apache.org/download-80.cgi#8.5.15