您的位置:首页 > 编程语言 > Java开发

Java Eclipse log4j配置

2015-09-17 14:01 501 查看
在project下新建一个文件,log4j.properties

文件中加入以下内容:

# log4j configuration used during build and unit tests
log4j.rootLogger=INFO,stdout
log4j.threshhold=ALL
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n


在Main函数里,配置:

PropertyConfigurator.configure("log4j.properties");

可以使用log4j打印日志了


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: