Disclaimer: I reserve all the rights of this article.
Part II: Configuring LOG4J
LOG4J is primarily a Java-generated Management Pack for log files, using logging-log4j-1.2.9 here. Decompression logging-log4j-1.2.9 compressed package, any path can be, here is D:\logging-log4j-1.2.9.
First build the project in the JBuilder and then introduce the log4j library file.
New project:
Select menu: New project...,name for trader, click Finish.
The project directory here is: E:\projects\Trader.
Copy class Library:
Create a new Lib folder under the Trader folder, and copy D:\logging-log4j-1.2.9\dist\lib\log4j-1.2.9.jar to E:\projects\Trader\lib.
To introduce a class library into engineering:
Select menu: Project〉project properties〉paths〉 Right tab required libraries > Add > tab page Archives, select E:\projects\Trader\lib, Select Log4j-1.2.9.jar in the list box on the right, all the way OK.
New Web module:
Select Menu: New〉web〉web module (WAR) 〉ok button 〉create Empty Web module〉next button, fill in name Webtrader, click the Finish button.
To increase the properties configuration file:
In the menu tree on the left of JBuilder select Webtrader〉module directory〉 Select web-inf〉 Right button new〉file, fill in log4j.properties OK.
The contents of the edited log4j.properties are as follows:
If the Log4j-init-file is isn't set, then no point in trying
if (file!= null) {
Propertyconfigurator.configure (Prefix+file);
}
}
public void Doget (HttpServletRequest req, httpservletresponse Res) {
}
Clean up resources
public void Destroy () {
}
}
To configure the Web.xml file:
In the menu tree on the left of JBuilder select Webtrader〉module directory〉web-inf, open Web.xml, <display-name>webtrader</display-name > Add the following content:
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.