Logging with log4j on tomcat jruby-rack for a Rails 3 application

一世执手 提交于 2019-11-30 09:30:11

We also did various experiments and finally settled with slf4j option. Coming from Java background we knew slf4j, so we didn't go further.

<context-param>
   <param-name>jruby.rack.logging</param-name>
   <param-value>slf4j</param-value>
 </context-param>

btw, there is no need to copy slf4j-simple-1.6.1.jar into tomcat/lib or WEB-INF/lib when using slf4j-log4jxxx.jar

It's possible that your early tests with commons-logging were showing zero bytes files because of bufferSize.

If your entries get flushed to the file when you stop Tomcat then this is indeed the case and you are falling foul of the default 8Kb buffer.

To disable, for immediate flushing try...

org.apache.juli.FileHandler.bufferSize = -1

on the specific handler...

So for localhost...

2localhost.org.apache.juli.FileHandler.bufferSize = -1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!