Wednesday, 10 November 2010

velocity.log Permission denied

(within JadaSite 2.03 using Apache Valocity 1.5)

I got a lot of Permission denied stacktraces for velocity.log within my catalina.out. It is not big problem for now, but these messages could lead to large catalina.log file which will effect performances of Web application.

Velocity's log file is written into current folder (for me /etc/init.d) by default setup. If tomcat user does not have the right to create that file, you'll get Permission denied error. According to the Apache's documentation, Velocity's setup can be changed within Java. But, I didn't like the idea of changing Jada's code just for that.

Instead, I have overridden Velocity default properties:

  • I got the original velocity.properties file from
    velocity-1.5.jar (in folder org/apache/velocity/runtime/defaults/)
  • I created new directories within Jada's WEB-INF/classes folder to have the same structure
  • I created a new file velocity.properties within just created folder
    WEB-INF/classes/org/apache/velocity/runtime/defaults/
  • In that new file, I put the contents from the original file, and changed the value in the line 32 to
    runtime.log = /tmp/velocity.log

Edit: Within this velocity log I got an error saying that class org.apache.log.format.Formatter is not found. The class can be found in avalon-logkit-2.2.1.jar (or any newer version I suppose). To fix this, download this jar and add it to the class path (I've put it in Jada's WEB-INF/lib/ folder).

3 comments:

Slune said...

Thank you very much. It helped me a lot.

Slune said...

I added this in to the velocity.properties:
runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem
runtime.log.logsystem.log4j.category=velocity

Kris said...

Event better with Log4J. Thanks

Check the following text - it might help to make event more precise setup:
http://minaret.biz/tips/tomcatLogging.html#velocity

Popular Posts