Cuando instatiating velocidad me sale este error (publicado sólo el "causado por" -Mensajes):registro de errores en la velocidad en los sistemas Linux
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)
Ésta es mi fragmento de código:
VelocityEngine ve = new VelocityEngine();
ve.evaluate(context, writer, "org.apache.velocity.runtime.log.NullLogChute", this.templateString);
En primero mi código era la siguiente:
runtimeServices = RuntimeSingleton.getRuntimeServices();
node = runtimeServices.parse(reader, templateName);
en mi máquina de Windows que funciona bien, pero en los sistemas Linux (Ubuntu 10.04) no funciona. Esto post no me ayuda mucho, ya que no he encontrado ninguna pista de qué directorio tengo que dar permisos de escritura.
descubrí, que el siguiente código está trabajando también en máquinas Linux:
String logPath = request.getRealPath("/velocity.log");
RuntimeSingleton.setProperty(RuntimeConstants.RUNTIME_LOG, logPath);
runtimeServices = RuntimeSingleton.getRuntimeServices();
node = runtimeServices.parse(reader, templateName);
No es una muy buena solución, ya que nunca podía estar seguro, si tengo permiso de escritura en mi contexto real camino. Lo mejor sería, simplemente apagando el registro de Velocity.
¿Qué diferente configuración de registro diferente tengo que configurar? ¿El NullLogChute
no funciona o lo uso de forma inapropiada?
¡Gracias de antemano!