tomcat Log Details

https://www.cnblogs.com/operationhome/p/9680040.html

1 tomcat log details

1.1 tomcat log configuration file

The configuration file of tomcat corresponding to the log: / conf/logging.properties under the tomcat directory.

tomcat's log level includes: SEVERE (highest level) > WARNING > INFO > CONFIG > FINE > FINER (elaborate) > FINEST (all content, lowest level)

tomcat has five types of logs: catalina, localhost, manager, admin, host-manager

/ Con/logging.properties configuration file:

 1 #Configurable items (5 types of logs): catalina, localhost, manager, admin, host-manager
 2 handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler,
 3 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
 4 
 5 #Log output to file and console
 6 .handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
 7 
 8 #Log output level: SEVERE (highest level) > WARNING > INFO > CONFIG > FINE > FINER (elaborate) > FINEST (all content, lowest level)
 9 #Configuration files make catalina log output level FINE
10 1catalina.org.apache.juli.FileHandler.level = FINE
11 #catalina file output location
12 1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
13 #The catalina log prefix is catalina
14 1catalina.org.apache.juli.FileHandler.prefix = catalina.
15 
16 #Configuration files make the localhost log output level FINE
17 2localhost.org.apache.juli.FileHandler.level = FINE
18 #localhost file output location
19 2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
20 #Localhost log prefix is localhost
21 2localhost.org.apache.juli.FileHandler.prefix = localhost.
22 
23 #Configuration files make the manager log output level FINE
24 3manager.org.apache.juli.FileHandler.level = FINE
25 #manager file output location
26 3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
27 #Manager log prefix is manager
28 3manager.org.apache.juli.FileHandler.prefix = manager.
29 
30 #Configuration files make the host-manager log output level FINE
31 4host-manager.org.apache.juli.FileHandler.level = FINE
32 #Output location of host-manager file
33 4host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
34 #Host-manager log prefix is host-manager
35 4host-manager.org.apache.juli.FileHandler.prefix = host-manager.
36 
37 #Configuration file makes console log output level FINE
38 java.util.logging.ConsoleHandler.level = FINE
39 #Console log output format
40 java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
41 
42 #localhost log file output level is INFO
43 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
44 #Localhost log file output processing class 2localhost.org.apache.juli.FileHandler
45 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler
46 
47 #manager log file output level is INFO
48 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
49 #Manager log file output processing class 3manager.org.apache.juli.FileHandler
50 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler
51 
52 #The output level of host-manager log file is INFO
53 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
54 #The host-manager log file output processing class 4host-manager.org.apache.juli.FileHandler
55 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler

1.2 tomcat log file details

tomcat has five types of logs: catalina, localhost, manager, admin, host-manager

 1.2.1 catalina.out :

catalina.out is standard output and standard error. All output to these two locations will go into catalina.out. This includes the logs of tomcat running its own output and the logs output to console in the application. By default, this log file will not be automatically cut, we need to use other tools to cut (note: catalina.out file if too big impact)

#Intercept partial logs
19-Sep-2018 09:53:28.358 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.53
19-Sep-2018 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jun 29 2018 14:42:45 UTC
19-Sep-2018 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.53.0
19-Sep-2018 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
19-Sep-2018 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            3.10.0-862.el7.x86_64
19-Sep-2018 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
19-Sep-2018 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/java/jdk1.8.0_131/jre
19-Sep-2018 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_131-b11
19-Sep-2018 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
19-Sep-2018 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /opt/tomcat
19-Sep-2018 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /opt/tomcat
19-Sep-2018 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
19-Sep-2018 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
19-Sep-2018 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
19-Sep-2018 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
19-Sep-2018 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
19-Sep-2018 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat
19-Sep-2018 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
19-Sep-2018 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
19-Sep-2018 09:53:28.362 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
19-Sep-2018 09:53:28.676 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
19-Sep-2018 09:53:28.716 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
19-Sep-2018 09:53:28.731 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
19-Sep-2018 09:53:28.732 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
19-Sep-2018 09:53:28.746 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1083 ms
19-Sep-2018 09:53:28.794 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
19-Sep-2018 09:53:28.794 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.53
19-Sep-2018 09:53:28.829 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/ROOT
19-Sep-2018 09:53:29.524 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/ROOT has finished in 694 ms
19-Sep-2018 09:53:29.524 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/docs
19-Sep-2018 09:53:29.552 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/docs has finished in 28 ms
19-Sep-2018 09:53:29.552 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/examples
19-Sep-2018 09:53:29.987 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/examples has finished in 434 ms
19-Sep-2018 09:53:29.987 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/host-manager
19-Sep-2018 09:53:30.033 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/host-manager has finished in 46 ms
19-Sep-2018 09:53:30.034 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/manager
19-Sep-2018 09:53:30.064 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/manager has finished in 29 ms
19-Sep-2018 09:53:30.082 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
19-Sep-2018 09:53:30.099 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
19-Sep-2018 09:53:30.106 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1360 ms
2018-09-19 16:52:10
 [] [] [INFO]-[Thread: DefaultQuartzScheduler_Worker-7] Start checking system

    1.2.2 catalina.YYYY-MM-DD.log

Catalina. {yyyyy-MM-dd}. log is some logs that tomcat runs on its own. These logs will also be exported to catalina.out, but the logs that the application outputs to console will not be exported to catalina. {yyy-MM-dd}. log, which is the running logs of tomcat when it starts and stops. Note that it is different from catalina.out. .

 View Code

 1.2.3 localhost.YYYY-MM-DD.log

Localhost. {yyyyy-MM-dd}. log is a log that is captured and output by tomcat after unhandled exceptions of application initialization (listener, filter, servlet). It also contains the running log when tomcat is started and paused, but it does not have the full catalina.2018-09-19.log. It just records some of the logs.

 View Code

 1.2.4 localhost_access_log.YYYY-MM-DD.txt

localhost_access_log.2018-09-19.txt: This is the log for accessing tomcat, requesting time and resources, and the status code is recorded.

192.168.1.220 - - [19/Sep/2018:03:57:42 -0400] "GET / HTTP/1.1" 200 11286
192.168.1.220 - - [19/Sep/2018:03:57:42 -0400] "GET /tomcat.css HTTP/1.1" 200 5581
192.168.1.220 - - [19/Sep/2018:03:57:42 -0400] "GET /tomcat.png HTTP/1.1" 200 5103
192.168.1.220 - - [19/Sep/2018:03:57:42 -0400] "GET /bg-button.png HTTP/1.1" 200 713
192.168.1.220 - - [19/Sep/2018:03:57:42 -0400] "GET /bg-nav.png HTTP/1.1" 200 1401
192.168.1.220 - - [19/Sep/2018:03:57:42 -0400] "GET /asf-logo-wide.svg HTTP/1.1" 200 27235
192.168.1.220 - - [19/Sep/2018:03:57:42 -0400] "GET /bg-middle.png HTTP/1.1" 200 1918
192.168.1.220 - - [19/Sep/2018:03:57:42 -0400] "GET /bg-upper.png HTTP/1.1" 200 3103
192.168.1.220 - - [19/Sep/2018:03:58:14 -0400] "GET / HTTP/1.1" 200 11286
192.168.1.220 - - [19/Sep/2018:03:58:14 -0400] "GET /favicon.ico HTTP/1.1" 200 21630
192.168.1.220 - - [19/Sep/2018:03:58:16 -0400] "GET / HTTP/1.1" 200 11286
192.168.1.220 - - [19/Sep/2018:03:58:16 -0400] "GET /favicon.ico HTTP/1.1" 200 21630
192.168.1.220 - - [19/Sep/2018:03:58:21 -0400] "GET / HTTP/1.1" 200 11286
192.168.1.220 - - [19/Sep/2018:03:58:21 -0400] "GET /favicon.ico HTTP/1.1" 200 21630
192.168.1.220 - - [19/Sep/2018:03:58:28 -0400] "GET /docs/setup.html HTTP/1.1" 200 14470
192.168.1.220 - - [19/Sep/2018:03:58:28 -0400] "GET /docs/images/docs-stylesheet.css HTTP/1.1" 200 5780
192.168.1.220 - - [19/Sep/2018:03:58:28 -0400] "GET /docs/images/tomcat.png HTTP/1.1" 200 5103
192.168.1.220 - - [19/Sep/2018:03:58:28 -0400] "GET /docs/images/asf-logo.svg HTTP/1.1" 200 20486
192.168.1.220 - - [19/Sep/2018:03:58:28 -0400] "GET /docs/images/fonts/fonts.css HTTP/1.1" 200 1943
192.168.1.220 - - [19/Sep/2018:03:58:29 -0400] "GET /docs/images/fonts/OpenSans400.woff HTTP/1.1" 200 21956
192.168.1.220 - - [19/Sep/2018:03:58:29 -0400] "GET /docs/images/fonts/OpenSans700.woff HTTP/1.1" 200 22748
192.168.1.220 - - [19/Sep/2018:03:58:29 -0400] "GET /docs/images/fonts/OpenSans600.woff HTTP/1.1" 200 22604

 1.2.5 host-manager.YYYY-MM-DD.log

host-manager.2018-09-19.log: This estimate is the log information of the manager project in tomcat. No important log information is seen.

  1.2.6 manager.YYYY-MM-DD.log

manager.2018-09-19.log: This is a log file exclusive to the tomcat manager project.

1.3 tomcat Log File Cutting

Tomcat's catalina.out file, tomcat, is not log-cutting. When the file is larger than 2G, it will affect the operation of tomcat. So we need to log the file, there are many ways to cut it:

The first is:

Cutting is done by logrotate, the cutting tool that comes with the system.

The second is:

Cut logs using logj4.

Third:

Using cronolog to segment tomcat catalina.out file

See https://www.cnblogs.com/happy-king/p/9193401.html

Authors: Ideal Trinity
Source: https://www.cnblogs.com/operationhome/p/9680040.html
If you think the article is well written or helpful, please give me a compliment and pay attention to it. Operations and Maintenance Learning Exchange Group: 544692191
Copyright of this article belongs to the author. Reproduction is welcome. If there are deficiencies or mistakes in the article, you must point out that this is not only a promotion for me to write, but also a responsibility for the people who read the article later. Thank you.

Keywords: PHP Apache Tomcat Java jvm

Added by ngoweb on Tue, 06 Aug 2019 05:43:31 +0300