开发者

Can someone show me how to set up log4j for jruby on rails on Tomcat?

开发者 https://www.devze.com 2023-04-10 03:19 出处:网络
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?

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.


  1. Just the log4j jar should be enough, AFAIK.
  2. In WEB-INF/classes. See log4j documentation for details.
  3. To tell Rails about log4j, set the context init parameter jruby.rack.logging to log4j:

    <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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号