Configuring Solr 1.4 logging with Log4J in Tomcat

Solr 1.4 logging is based on the “SLF4J” API . To configure Solr to use Log4J as standard logging implementation deploy the Solr web application to your Tomcat. Once the Solr web application got started add the libraries “slf4j-log4j12-1.5.5.jar” and “log4j-1.2.15.jar” to $CATALINA_HOME/webapps/solr/WEB-INF/lib . Delete the library “slf4j-jdk14-1.5.5.jar” from $CATALINA_HOME/webapps/solr/WEB-INF/lib .

Create the directory $CATALINA_HOME/webapps/solr/WEB-INF/classes and add the file log4j.properties . The file should hold your Log4J configuration. Here’s an example using a rolling log file:

1 log4j.rootLogger=ERROR, logfile
2  
3 log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
4 log4j.appender.logfile.File=${catalina.home}/logs/solr.log
5  
6 log4j.appender.logfile.DatePattern='.'yyyy-MM-dd
7 log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
8

log4j.appender.logfile.layout.ConversionPattern=%d %p [%c{3}] - [%t] - %X{ip}: %m%n

 

Alternatively, you can prepare your Solr web application WAR file to reflect the steps mentioned above. The Solr logging page (http://<host>:<port>/solr/admin/logging ) that comes with the web app will not reflect these changes. It only works for JDK logging that we just configured not to be used anymore. The Tomcat instance has to be restarted to reflect the changes.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值