Tomcat Catalina.out (one, catalina.out under Windows)

Source: Internet
Author: User
Tags touch command

Recently in the study of the project, found that the Linux operating system, catalina_home/logs/catalina.out files have several g size, then the Internet to check the generation of this file and how to avoid, the following is the material I organized:

Before we look at the log under the Linux system, there is always a habit of starting the project will enter the logs/, tapping the command similar to tail-fn500 catalina.out, can go into the catalina.out real-time display of the latest 500 lines of information, but there is a problem, in the Windows system we did not find this catalina.out, is it only in the Linux system has catalina.out files?

In fact, this is not the case, first of all, why in Linux is called Catalina.out, which is due to catalina_home/bin/catalina.sh file designation, see the following part of the source code:

  Shift
  touch "$CATALINA _base"/logs/catalina.out
  If ["$" = "-security"]; Then
    echo "Using Security Manager"
    shift
    "$_ Runjava "$JAVA _opts" $LOGGING _config "$CATALINA _opts \
     -djava.endorsed.dirs=" $ Java_endorsed_dirs "-classpath" $CLASSPATH "\
     -djava.security.manager \
      -djava.security.policy== "$CATALINA _base"/conf/catalina.policy \
      -dcatalina.base= "$CATALINA _base" \
     -dcatalina.home= "$CATALINA _home "\
     -djava.io.tmpdir=" $CATALINA _tmpdir "\
      Org.apache.catalina.startup.Bootstrap "[email protected]" Start \
      >> " $CATALINA _base "/logs/catalina.out 2>&1 &

if [!-Z "$CATALINA _pid"]; Then
Echo $! > $CATALINA _pid
Fi

Note: The touch command can create a nonexistent file

So the same can be imagined under Windows can also exist in the Catalina.out file (only the default file is not called this name), then you could see under the Windows System, or create a catalina.out it? The answer is yes, refer to the following:

  Since Tomcat itself can be cross-platform, since there is Linux under the catalina.sh, it should be under the Windows Catalina.bat

 Note Here we are going to modify two parts:

1. Open the Startup.bat file below the bin and change the call "%executable%" Start%cmd_line_args% to "%executable%" run%cmd_line_args%.
2, open the bin under the Catalina.bat file, you will find a total of 4%action%, add ">>%catalina_base%\logs\catalina.out" in the back.
Restart Tomcat, you will find in the Logs folder under the Catalina.out file, the original console information is all written in.
3. You can use the Hoo wintail software to open the Catalina.out file to view the log like Linux.

Note: Hoo wintail is a file viewer program under Windows, a bit like the Unix tail-f, You can view the ever-increasing tail of a file. It is ideal for real-time viewing of files such as application run logs or server logs while file generation is in place. It can view the last part of a huge file without having to load the entire file. It is a file viewer that opens the file as read-only, The open file is not altered. When another program writes a new row to the file, Hoo Wintail reads the new line and displays it. It can read and display any text file, does not support. doc files. xls files, or other special files.

Tomcat Catalina.out (one, catalina.out under Windows)

Related Article

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.