Meaning Tomcat logs folder under a different file

 

When every time you start tomcat, automatic production following log files in the logs directory, automatic backup date in accordance with
 

One localhost.2016-07-05.txt // frequently used files, when the program exception is not caught in the throws places

One frequently used files catalina.2016-07-05.txt // output of the program, tomcat log output, etc.

manager.2016-07-05.txt // estimates are proprietary project manager

host-manager.2016-07-05.txt // estimates are proprietary project manager

localhost_access_log.2016-10-01.txt // tomcat access logging, you need to configure

 

1. Let all files are output to the same file

 Open the Tomcat directory conf \ logging.properties, modified as follows, all log output to the beginning of the file tomcat

1catalina.org.apache.juli.FileHandler.level = FINE

1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

# 1catalina.org.apache.juli.FileHandler.prefix = catalina.

1catalina.org.apache.juli.FileHandler.prefix = tomcat.

 

2localhost.org.apache.juli.FileHandler.level = FINE

2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

# 2localhost.org.apache.juli.FileHandler.prefix = localhost.

2localhost.org.apache.juli.FileHandler.prefix = tomcat.

 

3manager.org.apache.juli.FileHandler.level = FINE

3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

# 3manager.org.apache.juli.FileHandler.prefix = manager.

3manager.org.apache.juli.FileHandler.prefix = tomcat.

 

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.

4host-manager.org.apache.juli.FileHandler.prefix = tomcat.

2. Open the access log
 

 

The default tomcat does not record the access log, the following method can make access log record tomcat

Edit $ {catalina} /conf/server.xml file Note: $ {catalina} is tomcat installation directory

The following comments () can be removed.

 

The above pattern can be modified format

The value may be: common and combined, the two pre-set contents well log output format corresponds to the following:

The common values:% h% l% u% t% r% s% b

combined 的值: %h %l %u %t %r %s %b %{Referer}i %{User-Agent}i

pattern may be freely combined as needed, for example, pattern = "% h% l"

For the meaning of each field, refer to the fields:

 

http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html the Access Log Valve items

3. Modify the tomcat log level

 

Tomcat log divided into the following five categories:

catalina 、 localhost 、 manager 、 admin 、 host-manager

Level of each class divided into the following 7 kinds of logs:

SEVERE (highest value) > WARNING > INFO > CONFIG > FINE > FINER > FINEST (lowest value)

 

Log level set method

Modify the contents of conf / logging.properties in setting the level of certain types of logs

Example:

 

Set catalina log level: FINE

1catalina.org.apache.juli.FileHandler.level = FINE

 

Disable output catalina log:

1catalina.org.apache.juli.FileHandler.level = OFF

 

Catalina output all log messages are output:

1catalina.org.apache.juli.FileHandler.level = ALL

Guess you like

Origin www.cnblogs.com/shoshana-kong/p/11106542.html