Home > Java > javaTutorial > body text

How to set up MyEclipse Console output to a file

巴扎黑
Release: 2017-07-17 13:59:51
Original
2399 people have browsed it

The default output of the Java program is Console. If you want to save the Console output results to a file, you need to make the following configuration:

Right-click on the JAVA program--> Run As --> Run Configurations

Select the Common window, set the file saving path, and whether to save the console output to the file in append mode.

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Log log=LogFactory.getLog("--start- -");
log.fatal("this id a fatal message");
log.error("this id a error message");
log.warn("this id a warn message" );
log.info("this id a info message");
if(log.isDebugEnabled()){
log.debug("this id a debug message");
}
LoginForm loginForm = (LoginForm) form;// TODO Auto-generated method stub
String name=loginForm.getName();
String password=loginForm.getPassword();
if(name. equals("abc")&&password.equals("111")){
return mapping.findForward("go");
}else{
return mapping.findForward("go1");
}

}

log4j.rootLogger=INFO,console,file
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.file=org .apache.log4j.RollingFileAppender
log4j.appender.file.File=d:/Log/log.html
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender. console.layout.ConversionPattern=%r%t%p-%m%n
log4j.appender.file.layout=org.apache.log4j.HTMLLayout

The above is the detailed content of How to set up MyEclipse Console output to a file. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!