Tomcat Log split by day

Source: Internet
Author: User


One, Tomcat console log (catalina.out) split

Install Cronolog tool, default location/usr/sbin/cronolog
Yum-y Install Cronolog
Which cronlog# view location
Modify the catalina.sh, the approximate position of the TOMCAT7 in 381-382 and 390-391 two places
First Amendment (381-382)
Will
Org.apache.catalina.startup.Bootstrap "[email protected]" start \
>> "$CATALINA _out" 2>&1 "&"
Revision changed to
Org.apache.catalina.startup.Bootstrap "[email protected]" Start 2>&1 \

|/usr/sbin/cronolog "$CATALINA _base"/logs/catalina.out.%y-%m-%d.out>>/dev/null &
Second Amendment (390-391)
Will
Touch "$CATALINA _out"
Revision changed to
#touch "$CATALINA _out"


Second, the configuration of the log:

The Tomcat logs fall into two categories:

1, access logs, record the time of access, the source of access, access to information and other related information.

2, run the log, record tomcat running information, exception, error message.


Access log configuration, in Server.xml The following tab edit, close the Access log comment The following paragraph content can be


<valve classname= "Org.apache.catalina.valves.AccessLogValve" directory= "Logs"

prefix= "Localhost_access_log" suffix= ". txt"

pattern= "%h%l%u%t &quot;%r&quot; %s%b "/>


The meaning of each parameter


ClassName: The official meaning must not be changed according to the default configuration.

Directory: the log location.

Prefix: Log file prefix.

Suffix: Log file suffix.

Pattern: Log mode parameter, set parameters are very rich, parameter description see the table below.

Resolvehosts: If this value is true, Tomcat translates the server IP address through DNS to the hostname and, if False, writes the server IP address directly.


Pattern parameter:

%a-Remote IP address

%A-Local IP address

%b-Number of bytes sent, excluding HTTP headers, if 0, use "-"

%B-Number of bytes sent, not including HTTP headers

%H-Remote Host name (if resolvehost=false, remote IP address)

%H-Request Agreement

%L-The remote logical user name returned from Identd (Always return '-')

%m-Method of request (Get,post, etc.)

%p-Local port number to which the request was received

%q-Query string (if present, to '? ') Start

%r-the first line of the request, containing the requested method and URI

%s-Status code of the response

%s-session ID of the user

%t-Log and time, using the usual log format

%u-Remote user after authentication (if present, otherwise '-')

%u-URI path of the request

%V-Name of the local server

%d-the time, in milliseconds, to process the request

%T-the time, in seconds, to process the request

--------------------------------------------------------------------

Run Log Configuration

There are 5 classes of running logs: Catalina, localhost, manager, admin, Host-manager

There are 7 levels for each type of log: WARNING > Info > CONFIG > FINE > Finer > FINEST (lowest value) The less information is reported

To modify the level of information in the Run log report at Conf/logging.properties


Tomcat Log split by day

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.