Oct 4

I have spent quite a bit of time on this and also Google around.  So I figured I will share:

This assume you are using rails 3.0 or above, Warbler, and Tomcat 7.0 above

  1. Download latest log4j.jar and put it in your rails project’s lib directory
  2. Put your log4j.properties file in the rails root directory
  3. Add this line in warble.rb: config.java_classes = FileList["log4j.properties"]
  4. Add this line in warble.rb: ┬áconfig.webxml.jruby.rack.logging = ‘log4j’


Step 2 and 3 will allow warbler to put log4j.properties into the WEB-INF/classes directory

Step 4 will make sure jruby-rack using log4j for logging.

If you run into any issue, check your log4j.properties.

Here is the standard one I use:

log4j.rootLogger=INFO, R

log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

Comments are closed.