Velocity tries to put the logfile in the directory Tomcat was started from, and I believe that is actually /.
You can force Velocity to log to Tomcat's standard log by adding these lines to your velocity.properties:
runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem
runtime.log.logsystem.log4j.category=velocity
runtime.log.logsystem.log4j.logger=velocity
The velocity.properties should go into /WEB-INF/velocity.properties but you can override that in you servlet definition in web.xml.
If you're initialising Velocity by properties and not the velocity.properties:
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);
Read more here:
http://velocity.apache.org/engine/devel/developer-guide.html#usinglog4jwithexistinglogger
and here:
http://minaret.biz/tips/tomcatLogging.html#velocity
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…