2018-06-07 15:59
@JFinal 我下载了jfinal_demo_for_maven,用里面的的BlogController测试:
public class BlogController extends Controller {
private Logger logger = Logger.getLogger(BlogController.class);
BlogService service = BlogService.me;
public void index() {
System.out.println("Test Index");
logger.info("测试首页");
setAttr("blogPage", service.paginate(getParaToInt(0, 1), 10));
render("blog.html");
}
}
logger.info("测试首页"); 控制台能打印出来。
但是我在项目中相同的配置,日志都没有打印出来?以下是相关配置:
log4j
log4j
1.2.16
provided
log4j.rootLogger=info, stdout, file
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%n%-d{yyyy-MM-dd HH:mm:ss}%n[%p]-[Thread: %t]-[%C.%M()]: %m%n
# Output to the File
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.DatePattern='_'yyyy-MM-dd'.log'
log4j.appender.file.File=./jfinal_demo_for_maven.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%n%-d{yyyy-MM-dd HH:mm:ss}%n[%p]-[Thread: %t]-[%C.%M()]: %m%n
还有哪里要配置吗?