Tomcat log directory 변경

톰캣 로그를 기존 directory를 ${CATALINA_BASE}/logs에서${CATALINA_BASE}/logs/tomcat 으로 변경하는 예제

  • catalina.out 경로 변경

1
vi /path/to/tomcat/bin/catalina.sh
1
2
3
4
# CATALINA_OUT 경로 변경
if [ -z "$CATALINA_OUT" ] ; then
CATALINA_OUT="$CATALINA_BASE"/logs/tomcat/catalina.out
fi
  • access log 경로 변경

1
vi /path/to/tomcat/conf/server.xml
1
2
3
4
5
6
7
8
9
<!-- Valve 태그의 directory 속성 변경 -->

<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs/tomcat"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b"
maxDays="90" />
  • 기타 log 경로 변경
1
vi /path/to/tomcat/conf/logging.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# ~~.diractory 경로 변경

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

1catalina.org.apache.juli.AsyncFileHandler.level = FINE
1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs/tomcat
1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.

2localhost.org.apache.juli.AsyncFileHandler.level = FINE
2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs/tomcat
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.

3manager.org.apache.juli.AsyncFileHandler.level = FINE
3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs/tomcat
3manager.org.apache.juli.AsyncFileHandler.prefix = manager.

4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs/tomcat
4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
Share