Deploy Tomcat under Windows Server, log the Tomcat console to a log file

Source: Internet
Author: User

In a Linux system, after Tomcat starts, a lot of information is written to the Catalina.out file by default, and we can track tomcat and related applications running through the Tail-f catalina.out. Under Windows, when we started Tomcat with Startup.bat, we found that the Catalina log was very different from the contents of the Linux record, and most of the information was output to the screen without logging into catalina.out. The content of this article is to implement the related console output in Windows to be recorded in the Catalina.out file in the background for future viewing.

Output the console information to the%catalina_base%\logs\catalina.out:

1, open the bin under the Startup.bat file, the bottom line of call "%executable%" Start%cmd_line_args%

Change to call "%executable%" Run%cmd_line_args%

Note: After this is set up, after running Tomcat, the log will not appear in real time to the Tomcat run window. 2. Open the Catalina.bat file below the bin and you will find 4%action% in the file, followed by >>%catalina_home%\logs\catalina.out Note: Back slash and Lin in Windows UX is anti-restart Tomcat, you will find in the Logs folder under the Catalina.out file, the original console information is all written in. But the output of this catalina.out file, is always growing, that is, the file will grow larger. 3. According to the above changes, all Tomcat logs will be written to the Logs/catalina.out file, and if you want to generate log files by day, you can add >>%catalina_home%/logs/after%action% Catalina.%date:~0,4%-%date:~5,2%-%date:~8,2%.out generates a format of catalina.yyyy-mm-dd.out (yyyy for 4-bit years, mm for 2-bit months, and DD for two-bit dates)

Deploy Tomcat under Windows Server, log the Tomcat console to a log file

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.