freemarker log4j警告
Posted zhjh256
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了freemarker log4j警告相关的知识,希望对你有一定的参考价值。
log4j:WARN No appenders could be found for logger (freemarker.cache).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
因为freemarker只依赖了log4j,不支持log4j2,所以必须在classpath中加上log4j.properties,否则就会出现上述警告。
# freemarker专用 Global logging configuration 这个配置是调试用的配置,生产环境要改成INFO或更高级别 log4j.rootLogger=DEBUG, stdout # Console output... log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern= %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
加上后如下:
2020-01-01 12:03:08 [ http-nio-8080-exec-1:0 ] - [ DEBUG ] Couldn‘t find template in cache for "system/login.html"("zh_CN", UTF-8, parsed); will try to load it. 2020-01-01 12:03:08 [ http-nio-8080-exec-1:2 ] - [ DEBUG ] TemplateLoader.findTemplateSource("system/login_zh_CN.html"): Not found 2020-01-01 12:03:08 [ http-nio-8080-exec-1:18 ] - [ DEBUG ] TemplateLoader.findTemplateSource("system/login_zh.html"): Not found 2020-01-01 12:03:08 [ http-nio-8080-exec-1:19 ] - [ DEBUG ] TemplateLoader.findTemplateSource("system/login.html"): Found 2020-01-01 12:03:08 [ http-nio-8080-exec-1:19 ] - [ DEBUG ] Loading template for "system/login.html"("zh_CN", UTF-8, parsed) from "class path resource [templates/system/login.html]" 2020-01-01 12:03:09 [ http-nio-8080-exec-1:142 ] - [ DEBUG ] "system/login.html"("zh_CN", UTF-8, parsed) cached copy not yet stale; using cached.
以上是关于freemarker log4j警告的主要内容,如果未能解决你的问题,请参考以下文章
java出现以下警告:WARN No appenders;WARN Please initialize the log4j的处理方法
在eclipse中运行wordcount,控制台打印log4j警告
Xcode8:"subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0" 的警告(代码片段