私は(ちょうど-messages "によって引き起こされる" 掲示)このエラーが出る:ログインエラーが
java.lang.RuntimeException: Velocity could not be initialized!
Caused by: org.apache.velocity.exception.VelocityException: Error initializing log: Failed to initialize an instance of org.apache.velocity.runtime.log.Log4JLogChute with the current runtime configuration.
Caused by: org.apache.velocity.exception.VelocityException: Failed to initialize an instance of org.apache.velocity.runtime.log.Log4JLogChute with the current runtime configuration.
Caused by: java.lang.RuntimeException: Error configuring Log4JLogChute :
Caused by: java.io.FileNotFoundException: velocity.log (Permission denied)
これは私のコードスニペットです:
VelocityEngine ve = new VelocityEngine();
ve.evaluate(context, writer, "org.apache.velocity.runtime.log.NullLogChute", this.templateString);
で私のWindowsマシン上で
runtimeServices = RuntimeSingleton.getRuntimeServices();
node = runtimeServices.parse(reader, templateName);
それがうまく動作しますが、Linuxシステム(10.04 Ubuntuの)で、それは動作しません:最初に私のコードは次のように見えました。このpostは、私が書き込み権限を与えなければならないディレクトリの手がかりを見つけられなかったので、あまり役に立たない。
私は、次のコードは、Linuxマシンでも動作していること、が分かった:
String logPath = request.getRealPath("/velocity.log");
RuntimeSingleton.setProperty(RuntimeConstants.RUNTIME_LOG, logPath);
runtimeServices = RuntimeSingleton.getRuntimeServices();
node = runtimeServices.parse(reader, templateName);
私は私の本当の文脈上の書き込み権限を持っている場合、私は、必ずすることができませんでしたので、それは、非常に素晴らしい解決策ではありませんパス。最高ののは、Velocityのロギングをオフにすることだけです。
どのような異なるロギング設定を設定する必要がありますか? NullLogChute
は機能していませんか、それとも不適切なのですか?
ありがとうございます!