码迷,mamicode.com
首页 > 其他好文 > 详细

修改tomcat6.0.25日志默认路径

时间:2016-07-11 01:27:02      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:tomcat 日志

默认情况下tomcat6.0.26日志存放路径为tomcat6.0.26/logs下:

[root@modelC65 tomcat6.0.26]# cd logs/

[root@modelC65 logs]# ll

total 0

-rw-r--r--. 1 root root 0 Jul 10 10:35 catalina.2016-07-10.log

-rw-r--r--. 1 root root 0 Jul 10 10:35 catalina.out

-rw-r--r--. 1 root root 0 Jul 10 10:35 host-manager.2016-07-10.log

-rw-r--r--. 1 root root 0 Jul 10 10:35 localhost.2016-07-10.log

-rw-r--r--. 1 root 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]# 

日志配置文件为:logging.properties

即:

[root@modelC65 conf]# ll

total 92

drwxr-xr-x. 3 root root  4096 Apr 15  2015 Catalina

-rw-r--r--. 1 root root  8945 Feb 10  2015 catalina.policy

-rw-r--r--. 1 root root  3713 Feb 10  2015 catalina.properties

-rw-r--r--. 1 root root  1395 Feb 10  2015 context.xml

-rw-r--r--. 1 root root  3257 Feb 10  2015 logging.properties

-rw-r--r--. 1 root root  6843 Jul 10 10:32 server.xml

-rw-r--r--. 1 root root  1521 Feb 10  2015 tomcat-users.xml

-rw-r--r--. 1 root root 50875 Feb 10  2015 web.xml

[root@modelC65 conf]# 

具体为:

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.


修改指定的路径如下:

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.

其中catalina.out日志文件定义路径又存在于tomcat/bin/catalina.sh中,即:

 CATALINA_OUT    (Optional) Full path to a file where stdout and stderr

                  will be redirected. 

                  Default is $CATALINA_BASE/logs/catalina.out


所以在文件catalina.sh中可以重新定义catalina.out存放路径,比如:

CATALINA.OUT=/opt/app_1/logs/catlina.out

另外对于访问日志access.log定义可以在conf/server.xml中定义

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"

               prefix="app_1_access." suffix=".log" pattern="%{X-Real-IP}i %m %H %h%{Request_uri}i %q" resolveHosts="false"/>


修改directory="logs" 为 directory="/opt/app_1/logs"


本文出自 “平平淡淡才是真” 博客,请务必保留此出处http://ucode.blog.51cto.com/10837891/1816340

修改tomcat6.0.25日志默认路径

标签:tomcat 日志

原文地址:http://ucode.blog.51cto.com/10837891/1816340

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!