在MAIN方法中使用log4j
来源:互联网 发布:js 禁止div点击事件 编辑:程序博客网 时间:2024/05/18 01:50
1.在main方法中加载
view plaincopy to clipboardprint?
//同时输出到控制台和一个文件的实例并实现了Logger的继承
PropertyConfigurator.configure("E://workspace//log4jtest//log4j.properties");
logger.debug("Start of the main() in TestLog4j");
logger.info("Just testing a log message with priority set to INFO");
logger.warn("Just testing a log message with priority set to WARN");
logger.error("Just testing a log message with priority set to ERROR");
logger.fatal("Just testing a log message with priority set to FATAL");
logger.log(Priority.WARN, "Testing a log message use a alternate form");
logger.debug(TestLog4j.class.getName());
//同时输出到控制台和一个文件的实例并实现了Logger的继承
PropertyConfigurator.configure("E://workspace//log4jtest//log4j.properties");
logger.debug("Start of the main() in TestLog4j");
logger.info("Just testing a log message with priority set to INFO");
logger.warn("Just testing a log message with priority set to WARN");
logger.error("Just testing a log message with priority set to ERROR");
logger.fatal("Just testing a log message with priority set to FATAL");
logger.log(Priority.WARN, "Testing a log message use a alternate form");
logger.debug(TestLog4j.class.getName());
然后在需要的地方加logger.debug就可以了
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/xiaxiaorui2003/archive/2009/08/20/4466634.aspx
- 在MAIN方法中使用log4j
- 在MAIN方法中使用log4j
- 在 wpf 中使用 main 方法
- maven之helloworld——使用log4j在main中打印输出
- 在 JBuilder 中使用 Log4j
- 在eclipse中使用log4j
- 在应用程序中使用log4j
- 在javaweb中使用log4j
- 在web中使用log4j
- 在Liferay中使用Log4j
- 在java中使用log4j
- 在android中运行java main方法
- 在android中运行java main方法
- 在android中运行java main方法
- 在main方法中调用service
- 在android中运行java main方法
- 在android中使用main()调试
- Log4j的使用和怎么在spring中集成log4j
- 帮网友改的处理键盘事件模型
- 经典的农夫养牛问题
- SYSTEMTIME
- Oracle与DB2数据类型分类对应说明
- 关于硕士毕业论文自动生成目录和参考文献上标的一些小技
- 在MAIN方法中使用log4j
- 新语录!
- J2EE工程+Log4j日志
- 单证书和双证书的签发流程
- AIX 常用命令
- 心得
- 图书管理系统
- 学习的体验
- ubunut下执行bin文件