Can someone show me how to set up log4j for jruby on rails on Tomcat?
I follow several direction and none of them seems to be working. Here are my specific question. 1. What jars to include in lib directory? 2. Where should I put the log4j.properties?开发者_JAVA百科 What it should look like? 3. How did rails know to use log4j? None of the direction mentioned that I need to change environment.rb or environments/production.rb to change the logger configuration. How did rails know to use log4j? Many thanks.
- Just the log4j jar should be enough, AFAIK.
- In WEB-INF/classes. See log4j documentation for details.
To tell Rails about log4j, set the context init parameter
jruby.rack.logging
tolog4j
:<context-param> <param-name>jruby.rack.logging</param-name> <param-value>log4j</param-value> </context-param>
Then JRuby-Rack will set the Rails logger to use log4j at startup.
精彩评论