REDIRECT Tomcat log output in eclipse

Source: Internet
Author: User
Tags apache tomcat

During development, using the Eclipse tool to start Tomcat or during project debugging, you need to monitor the output's log information in the console, but only the most recent log information is retained in the Eclipse console, and the previous information disappears. It is therefore entirely necessary to redirect the output of the log as follows:

1. In eclipse, click Run->run configurations ... (or Debug configurations ...) ), enter the following configuration page:

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/7F/78/wKioL1cgIungnCF5AAO3uETLeUg164.jpg "title=" 1.jpg " alt= "Wkiol1cgiungncf5aao3uetleug164.jpg"/>

On the Apache Tomcat menu, double-click (or right-click New) to increase the Tomcat instance information.

2. Click on the newly added Tomcat instance name as shown in:

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/7F/7B/wKiom1cgJBbAK7AjAAQmSGyOENg679.jpg "title=" 2.jpg " alt= "Wkiom1cgjbbak7ajaaqmsgyoeng679.jpg"/>

The instance name can be modified when the Tomcat instance is added to the current page, and if more than one tomcat can be selected in the server option via the drop-down box, the configuration is completed by clicking Apply.

3. Then open the Arguments tab on the current page to configure the Tomcat instance related parameters:

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/7F/7B/wKiom1cgJYyyO6NaAARXZpafSe8346.jpg "title=" 3.jpg " alt= "Wkiom1cgjyyyo6naaarxzpafse8346.jpg"/>

, the parameter configuration page needs to increment the variable start in the program arguments item, adding the following configuration in the VM arguments item:

-dcatalina.base= "E:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0"-dcatalina.home= "E:\Tools\ tomcat\apache-tomcat-7.0.61 "-dwtp.deploy=" E:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\ Wtpwebapps "-djava.endorsed.dirs=" E:\Tools\Tomcat\apache-tomcat-7.0.61\endorsed "

Note: You can copy the above parameter information directly, but you need to modify the directory to the native actual directory information

Configuration Complete Click Apply.

4. Then select the Classpath tab on the current page to configure the package that the Tomcat instance depends on, as follows:

650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/7F/7B/wKiom1cgJ7yAwGhTAAPasih8WoQ148.jpg "title=" 4.jpg " alt= "Wkiom1cgj7yawghtaapasih8woq148.jpg"/>

As shown, first select User Entries, then click Add External JARs ..., On the pop-up page select the Tomcat home directory in the bin directory of Bootstrap.jar and Tomcat-juli.jar two packages and determine that the configuration is complete by clicking the Apply button.

5. Finally, select the Common tab on the current page to configure the log output of Tomcat:

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/7F/7B/wKiom1cgKZWhrri8AASgjPCCZeU396.jpg "title=" 5.jpg " alt= "Wkiom1cgkzwhrri8aasgjpcczeu396.jpg"/>

On the above page, it is recommended to modify encoding to UTF-8 format, check the file check box in the standard Input and output item (if you do not cancel the Allocat console check box, the log file will be output to the console), and click File System ... Button Select Log to save the directory, after completion tick append to ensure that the output log in the form of an append log, configuration complete click the Apply button.

6. Click the Run button to test whether the log redirection configuration takes effect:

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/7F/78/wKioL1cgLT3BDcgCAAE1mMlt9iU501.jpg "title=" 6.jpg " alt= "Wkiol1cglt3bdcgcaae1mmlt9iu501.jpg"/>

You can see that the Tomcat log redirection configuration is already in effect.

REDIRECT Tomcat log output in eclipse

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.