Failed to initialize an instance of org.apache.velocity.runtime.log.Log4JLogChute with the current runtime configuration.
stackOverflow 上有一个相似的问题,我也遇到这个问题了
其中一个解决方案适合我
解决方案:
如果项目有配置velocity.properties
在配置中加入以下K-V键值对
runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem
runtime.log.logsystem.log4j.category=velocity
runtime.log.logsystem.log4j.logger=velocity
如果没有此配置文件
则在初始化velocity引擎的时候加入这些键值对配置
VelocityEngine engine = new VelocityEngine();
Properties props = new Properties();
props.put("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.SimpleLog4JLogSystem");
props.put("runtime.log.logsystem.log4j.category", "velocity");
props.put("runtime.log.logsystem.log4j.logger", "velocity");
engine.init(props);
解释说明:
velocity 引擎启动之后,其尝试将日志文件写入tomcat所在目录文件中去,所以你可以强制将日志写入tomcat标准日志中去,要做到这样就是以上所配置的属性
tomcat服务器启动之后,只要在之后操作中启动velocity引擎,就会看到其相关日志输出,本有velocity.properties配置文件