Hafiz Muhammad Shafiq
Hafiz Muhammad Shafiq

Reputation: 8678

How to configure Apache solr for daily logs

I am using solr 4.10. It generates log files of format solr.log, solr.log.1, solr.log.2. I want that It should generate one file for each date. Can anyone guide me how to do it.

Upvotes: 1

Views: 2644

Answers (2)

James Doepp - pihentagyu
James Doepp - pihentagyu

Reputation: 1308

Use log4j. In the log4j.properties file include the following:

log4j.rootLogger=WARN, file
...

log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.File=solr.log
log4j.appender.file.DatePattern='.'yyyy-MM-dd

To use log4j in logging, include the following in your solr.in.sh

LOG4J_PROPS=/path/to/log4j.properties

Upvotes: 3

Abhijit Bashetti
Abhijit Bashetti

Reputation: 8668

Add the entried in logging.proeperties which is at the folder apache tomcat/conf.

6localhost.org.apache.juli.FileHandler.level = FINE
6localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
6localhost.org.apache.juli.FileHandler.prefix = solr.

Register the handler at the top in the file where all the other handlers are :

6localhost.org.apache.juli.FileHandler

add the below entry at the last

org.apache.solr.level=INFO
org.apache.solr.handlers=6localhost.org.apache.juli.FileHandler

you will get a seperate solr.log file with date where in you will have all the solr logs.

Along with this do check the documentation

https://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/juli/FileHandler.html

rotatable - If true, the log file will be rotated on the first write past midnight and the filename will be {prefix}{date}{suffix}, where date is yyyy-MM-dd. If false, the file will not be rotated and the filename will be {prefix}{suffix}. Default value: true

Check whats the value for

1catalina.org.apache.juli.FileHandler.rotatable = true

Upvotes: 0

Related Questions