I’m new to solr and not very good with java.
we are using solr as our search solution and tomcat is hosted as a service in windows and solr is runs in tomcat.
We are trying to implement log rotation for tomcat. We tried using log4j.properties
in and logging.properties
. But for sine reason the stdout and stderr are still piling up and are consuming a lot of space.
We are using log4j.properties
to rotate solr logs.
Grateful if we could get some help for rotating stdout and stderr logs.
We have tried 3 different methods and none of them worked as expected.
Added stdout to log4j.properties
solr.log=logs/ log4j.rootLogger=ERROR, stdout
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x \u2013 %m%n
size rotation with log cleanup.
log4j.appender.stdout=org.apache.log4j.RollingFileAppender log4j.appender.stdout.MaxFileSize=4MB log4j.appender.stdout.MaxBackupIndex=9
- File to log to and log format
log4j.appender.stdout.File=${solr.log}/solr.log log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%-5p - %d{yyyy-MM-dd HH:mm:ss.SSS}; %C; %m\n
Added file size limit to logging.properties in tomcat.
java.util.logging.FileHandler.limit = 2000000 java.util.logging.FileHandler.count = 5
Update the Java properties in Monitor Tomcat applications.
added the below to java option under java tab in tomcat
-Djava.util.logging.FileHandler.limit=25000000
All theese attempts failed and we had to restart the tomcat to rotate the file which is not desirable in production.
Tomcat: 8.0.20
Solr: 4.10.3
OS: Windows