Solr: how to turn down logging
Having done this for log4j for SOLR I can tell you it was painful. Log4j doesn't work well with SOLR out the box. Anyway, here is what I did to make SOLR work with slf4j and log4j. If there is an easier way - awesome - do it.
In solr/lib
- Add slf4j-log4j12-1.5.11.jar ( make sure versions match to slf4j-api-??? )
- Remove slf4j-jdk14-1.5.5.jar (important - otherwise log4j doesnt get used)
in resources in your webapp add your log4j.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "/WEB-INF/log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" >
<appender class="org.apache.log4j.DailyRollingFileAppender" name="FILE" >
<param name="file" value="logs/jetty.log" />
<param name="datePattern" value="'.'yyyy-MM" />
<param name="append" value="true" />
<layout class="org.apache.log4j.PatternLayout" >
<param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
</layout>
</appender>
<root>
<priority value="error"></priority>
<appender-ref ref="FILE" />
</root>
</log4j:configuration>
Following link discusses how to configure Solr logging properly.
http://lucidworks.lucidimagination.com/display/solr/Configuring+Logging
If you want to make changes to logging temporarily, then it can done from the Solr admin page. For making changes permanently you will need to add a JDK logging properties file to Solr web application.
For tomcat following are the steps
- Create the classes directory in the WB_INF foler for solr web application i.e. _%TOMCAT_INSTALL_DIR%/webapps/solr/WEB-INF/classes/logging.properties_
- Create logging.properties file
- Add following entries for setting log level (log levels can be set from FINEST to SEVERE for a class or an entire package)
org.apache.commons.digester.Digester.level = FINEST
org.apache.solr.level = WARNING
If you are just looking to turn off logging completely from the Solr server , just visit http://(YOUR-IP):8080/solr/admin and navigate to the logging option seen on top list.
On that page , you could find the detailed table for the various logging levels defined for your Solr installation. Either change their parent logger to make them use the logger you are using in your application or turn them off entirely.
Hope this is what you were looking for. Thanks
You need to make sure that the logging properties file is deployed to
.../yourWebapp/WEB-INF/classes/log4j.properties
.If there is a
.../yourWebapp/WEB-INF/classes/log4j.xml
file, this will override the properties file.The location of the Log4j configuration file can also be overridden by system properties.
For more information on how Log4j gets its configuration, look at this section of the Log4j introduction.