Configure the Catalina.out log format

Source: Internet
Author: User

When you start Tomcat, the log format that is output in catalina.out may not be ideal.

See the default format for some versions:

April 24, 2018 6:49:32 pm Org.apache.catalina.startup.Catalina start
Info: Server Startup in 9772 MS

A bit awkward, want to adjust to the following format:

24-apr-2018 18:52:16.134 INFO [main] Org.apache.catalina.startup.Catalina.start Server startup in 12631 MS

Google search "catalina.out log format", see some articles, found through the ${tomcat-base}/conf/logging.properties file configuration.

Where ${tomcat-base} refers to the working directory of the specific running instance. ${tomcat-home} is the installation directory.

That is, on a single server, you can install a Tomcat, specify multiple base working directories, and you can start multiple instances.

That's what the idea editor did. Through the jps-v can see some clues.

The specific configuration information is as follows, you can directly overwrite this file. or copy from the bottom of a valid instance.

Logging.properties

handlers = 1catalina.org.apache.juli.asyncfilehandler, 2localhost.org.apache.juli.asyncfilehandler, 3manager.org.apache.juli.asyncfilehandler, 4host-manager.org.apache.juli.asyncfilehandler, Java.util.logging.ConsoleHandler. Handlers = 1catalina.org.apache.juli.asyncfilehandler, Java.util.logging.ConsoleHandler ############################################################ # 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

1catalina.org.apache.juli.asyncfilehandler.prefix = Catalina. 2localhost.org.apache.juli.asyncfilehandler.level = FINE 2localhost.org.apache.juli.asyncfilehandler.directory = ${

Catalina.base}/logs 2localhost.org.apache.juli.asyncfilehandler.prefix = Catalina. 3manager.org.apache.juli.asyncfilehandler.level = FINE 3MANAGER.ORG.APACHE.JULI.ASyncfilehandler.directory = ${catalina.base}/logs 3manager.org.apache.juli.asyncfilehandler.prefix = Catalina.
4host-manager.org.apache.juli.asyncfilehandler.level = FINE
4host-manager.org.apache.juli.asyncfilehandler.directory = ${catalina.base}/logs

4host-manager.org.apache.juli.asyncfilehandler.prefix = Catalina.
# key format information is here!!!

# can also be other configuration, please search yourself. Java.util.logging.ConsoleHandler.level = FINE Java.util.logging.ConsoleHandler.formatter = Org.apache.juli.OneLineFormatter ############################################################ # Facility specific
Properties.
# provides extra control for each logger. ############################################################ Org.apache.catalina.core.ContainerBase. [Catalina]. [Localhost].level = INFO org.apache.catalina.core.ContainerBase. [Catalina]. [localhost].handlers = 2localhost.org.apache.juli.asyncfilehandler org.apache.catalina.core.ContainerBase. [Catalina]. [localhost]. [/manager].level = INFO org.apache.catalina.core.ContainerBase. [CatAlina]. [localhost]. [/manager].handlers = 3manager.org.apache.juli.asyncfilehandler org.apache.catalina.core.ContainerBase. [Catalina]. [localhost]. [/host-manager].level = INFO org.apache.catalina.core.ContainerBase. [Catalina]. [localhost].
 [/host-manager].handlers = 4host-manager.org.apache.juli.asyncfilehandler

Of course, upgrade is the best upgrade version.

For more information, please refer to: https://tomcat.apache.org/tomcat-8.0-doc/logging.html

May 7, 2018

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.