Modify the default Log Path of Tomcat6.0.25
By default, the log storage path of atat6.0.26 is atat6.0.26/logs:
[Root @ modelC65 tomcat6.0.26] # cd logs/
[Root @ modelC65 logs] # ll
Total 0
-Rw-r --. 1 root 0 Jul 10 10:35 catalina.2016-07-10.log
-Rw-r --. 1 root 0 Jul 10 10:35 catalina. out
-Rw-r --. 1 root 0 Jul 10 host-manager.2016-07-10.log
-Rw-r --. 1 root 0 Jul 10 :35 localhost.2016-07-10.log
-Rw-r --. 1 root 0 Jul 10 10:35 manager.2016-07-10.log
[Root @ modelC65 logs] # pwd
/Application/app_1/tomcat6.0.26/logs
[Root @ modelC65 logs] #
Log configuration file: logging. properties
That is:
[Root @ modelC65 conf] # ll
Total 92
Drwxr-xr-x. 3 root 4096 Apr 15 2015 Catalina
-Rw-r --. 1 root 8945 Feb 10 2015 catalina. policy
-Rw-r --. 1 root 3713 Feb 10 2015 catalina. properties
-Rw-r --. 1 root 1395 Feb 10 2015 context. xml
-Rw-r --. 1 root 3257 Feb 10 2015 logging. properties
-Rw-r --. 1 root 6843 Jul 10 10:32 server. xml
-Rw-r --. 1 root 1521 Feb 10 2015 tomcat-users.xml
-Rw-r --. 1 root 50875 Feb 10 2015 web. xml
[Root @ modelC65 conf] #
Specifically:
1catalina.org. apache. juli. FileHandler. level = FINE
1catalina.org. apache. juli. FileHandler. directory =$ {catalina. base}/logs
1catalina.org. apache. juli. FileHandler. prefix = catalina.
2localhost.org. apache. juli. FileHandler. level = FINE
2localhost.org. apache. juli. FileHandler. directory =$ {catalina. base}/logs
2localhost.org. apache. juli. FileHandler. prefix = localhost.
3manager.org. apache. juli. FileHandler. level = FINE
3manager.org. apache. juli. FileHandler. directory =$ {catalina. base}/logs
3manager.org. apache. juli. FileHandler. prefix = manager.
4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory =$ {catalina. base}/logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.
Modify the specified path as follows:
1catalina.org. apache. juli. FileHandler. level = FINE
1catalina.org. apache. juli. FileHandler. directory =/opt/app_1/logs
1catalina.org. apache. juli. FileHandler. prefix = catalina.
2localhost.org. apache. juli. FileHandler. level = FINE
2localhost.org. apache. juli. FileHandler. directory =/opt/app_1/logs
2localhost.org. apache. juli. FileHandler. prefix = localhost.
3manager.org. apache. juli. FileHandler. level = FINE
3manager.org. apache. juli. FileHandler. directory =/opt/app_1/logs
3manager.org. apache. juli. FileHandler. prefix = manager.
4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory =/opt/app_1/logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.
The path defined in the catalina. out log file is stored in tomcat/bin/catalina. sh, that is:
CATALINA_OUT (Optional) Full path to a file where stdout and stderr
Will be redirected.
Default is $ CATALINA_BASE/logs/catalina. out
Therefore, you can redefine the catalina. out storage path in the catalina. sh file, for example:
CATALINA. OUT =/opt/app_1/logs/catlina. out
You can also define access log access. log in conf/server. xml.
<Valve className = "org. apache. catalina. valves. AccessLogValve" directory = "logs"
Prefix = "app_token access. "suffix = ". log "pattern =" % {X-Real-IP} I % m % H % h % {Request_uri} I % q "resolveHosts =" false "/>
Change directory = "logs" to directory = "/opt/app_1/logs"
For more Tomcat tutorials, see the following:
Install and configure the Tomcat environment in CentOS 6.6
Install JDK + Tomcat in RedHat Linux 5.5 and deploy Java Projects
Tomcat authoritative guide (second edition) (Chinese/English hd pdf + bookmarks)
Tomcat Security Configuration and Performance Optimization
How to Use Xshell to view Tomcat real-time logs with Chinese garbled characters in Linux
Install JDK and Tomcat in CentOS 64-bit and set the Tomcat Startup Procedure
Install Tomcat in CentOS 6.5
Tomcat details: click here
Tomcat: click here
This article permanently updates the link address: