Apache Lucene open-source search software
SOLR-12144: SOLR_LOG_PRESTART_ROTATION now defaults to false, we leverage log4j2 for log rotation on startup
Jan Høydahl0989e5874a34
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex f99bd39ea17..d7a01f66542 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -59,10 +59,11 @@ Upgrade Notes* SOLR-7887: Solr now uses Log4J 2.11 . The log4j configuration is now in log4j2.xml rather than log4j.properties files.This is a server side change only and clients using SolrJ won't need any changes. Clients can still use any logging- implementation which is compatible with SLF4J.+ implementation which is compatible with SLF4J. We now let log4j2 handle rotation of solr logs at startup, and bin/solr+ start scripts will no longer attempt this nor move existing console or GC logs into logs/archived either (SOLR-12144).-* SOLR-11673: Slave doesn't commit empty index when completely new index is detected on master during replication.- To return the previous behavior pass false to skipCommitOnMasterVersionZero in slave section of replication+* SOLR-11673: Slave doesn't commit empty index when completely new index is detected on master during replication.+ To return the previous behavior pass false to skipCommitOnMasterVersionZero in slave section of replicationhandler configuration, or pass it to the fetchindex command.New Features@@ -75,7 +76,7 @@ New Featuresatomic.<multival-field-name>=add-distict (Amrit Sarkar via noble)* SOLR-7887: Upgrade Solr to use Log4J 2.11- (Tim Potter, Keith Laban, Shawn Heisey, Ralph Goers, Erick Erickson, Varun Thacker)+ (Tim Potter, Keith Laban, Shawn Heisey, Ralph Goers, Erick Erickson, Varun Thacker)Bug Fixes----------------------@@ -99,7 +100,7 @@ Bug Fixesdocument. Multithreaded test for AtomicUpdateRequestProcessor was also beefed up and fixed.(Ishan Chattopadhyaya, Noble Paul, Amrit Sarkar, shalin)-* SOLR-11673: By default slave doesn't commit empty index when completely new index appears on master.+* SOLR-11673: By default slave doesn't commit empty index when completely new index appears on master.See Upgrade Notes to find a way to get back to the previous behavior. (Mikhail Khludnev)* SOLR-9399: Delete requests do not send credentials & fails for Basic Authentication@@ -154,6 +155,8 @@ Other Changes* SOLR-12169: Fix ComputePlanActionTest.testSelectedCollections fails on jenkins by aggressively cleaning uptrigger state left by other test methods in the test setup. (shalin)+* SOLR-12144: SOLR_LOG_PRESTART_ROTATION now defaults to false, we leverage log4j2 for log rotation on startup (janhoy)+================== 7.3.0 ==================Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.diff --git a/solr/bin/solr b/solr/bin/solrindex 64875409f21..75e311e25fc 100755--- a/solr/bin/solr+++ b/solr/bin/solr@@ -1819,10 +1819,12 @@ if $verbose ; thenelseq="-q"fi-if [ "${SOLR_LOG_PRESTART_ROTATION:=true}" == "true" ]; then- run_tool utils -s "$DEFAULT_SERVER_DIR" -l "$SOLR_LOGS_DIR" $q -remove_old_solr_logs 7 || echo "Failed removing old solr logs"- run_tool utils -s "$DEFAULT_SERVER_DIR" -l "$SOLR_LOGS_DIR" $q -archive_gc_logs $q || echo "Failed archiving old GC logs"- run_tool utils -s "$DEFAULT_SERVER_DIR" -l "$SOLR_LOGS_DIR" $q -archive_console_logs || echo "Failed archiving old console logs"+# Rotate and clean on startup. Default to false since 7.4 as log4j2 handles startup rotation+if [ "${SOLR_LOG_PRESTART_ROTATION:=false}" == "true" ]; then+ # Enable any of these if you require old remove/archive behavior+ #run_tool utils -s "$DEFAULT_SERVER_DIR" -l "$SOLR_LOGS_DIR" $q -remove_old_solr_logs 7 || echo "Failed removing old solr logs"+ #run_tool utils -s "$DEFAULT_SERVER_DIR" -l "$SOLR_LOGS_DIR" $q -archive_gc_logs $q || echo "Failed archiving old GC logs"+ #run_tool utils -s "$DEFAULT_SERVER_DIR" -l "$SOLR_LOGS_DIR" $q -archive_console_logs || echo "Failed archiving old console logs"run_tool utils -s "$DEFAULT_SERVER_DIR" -l "$SOLR_LOGS_DIR" $q -rotate_solr_logs 10 || echo "Failed rotating old solr logs"fidiff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmdindex 15c4b500d3e..54e3f7da811 100644--- a/solr/bin/solr.cmd+++ b/solr/bin/solr.cmd@@ -1070,14 +1070,15 @@ if !JAVA_MAJOR_VERSION! LSS 9 (set IS_64bit=true)-REM Clean up and rotate logs+REM Clean up and rotate logs. Default to false since 7.4 as log4j2 handles startup rotationIF [%SOLR_LOG_PRESTART_ROTATION%] == [] (- set SOLR_LOG_PRESTART_ROTATION=true+ set SOLR_LOG_PRESTART_ROTATION=false)IF [%SOLR_LOG_PRESTART_ROTATION%] == [true] (- call :run_utils "-remove_old_solr_logs 7" || echo "Failed removing old solr logs"- call :run_utils "-archive_gc_logs" || echo "Failed archiving old GC logs"- call :run_utils "-archive_console_logs" || echo "Failed archiving old console logs"+ REM Enable any of these if you require old remove/archive behavior+ REM call :run_utils "-remove_old_solr_logs 7" || echo "Failed removing old solr logs"+ REM call :run_utils "-archive_gc_logs" || echo "Failed archiving old GC logs"+ REM call :run_utils "-archive_console_logs" || echo "Failed archiving old console logs"call :run_utils "-rotate_solr_logs 9" || echo "Failed rotating old solr logs")diff --git a/solr/bin/solr.in.cmd b/solr/bin/solr.in.cmdindex 6f7867fe278..0962510fe4b 100644--- a/solr/bin/solr.in.cmd+++ b/solr/bin/solr.in.cmd@@ -84,10 +84,10 @@ REM set SOLR_LOG_LEVEL=INFOREM Location where Solr should write logs to. Absolute or relative to solr start dirREM set SOLR_LOGS_DIR=logs-REM Enables log rotation, cleanup, and archiving before starting Solr. Setting SOLR_LOG_PRESTART_ROTATION=false will skip start-REM time rotation of logs, and the archiving of the last GC and console log files. It does not affect Log4j configuration. This-REM pre-startup rotation may need to be disabled depending how much you customize the default logging setup.-REM set SOLR_LOG_PRESTART_ROTATION=true+REM Enables log rotation before starting Solr. Setting SOLR_LOG_PRESTART_ROTATION=true will let Solr take care of pre+REM start rotation of logs. This is false by default as log4j2 handles this for us. If you choose to use another log+REM framework that cannot do startup rotation, you may want to enable this to let Solr rotate logs on startup.+REM set SOLR_LOG_PRESTART_ROTATION=falseREM Set the host interface to listen on. Jetty will listen on all interfaces (0.0.0.0) by default.REM This must be an IPv4 ("a.b.c.d") or bracketed IPv6 ("[x::y]") address, not a hostname!diff --git a/solr/bin/solr.in.sh b/solr/bin/solr.in.shindex d023b38a296..685882ade18 100644--- a/solr/bin/solr.in.sh+++ b/solr/bin/solr.in.sh@@ -105,10 +105,10 @@# Location where Solr should write logs to. Absolute or relative to solr start dir#SOLR_LOGS_DIR=logs-# Enables log rotation, cleanup, and archiving during start. Setting SOLR_LOG_PRESTART_ROTATION=false will skip start-# time rotation of logs, and the archiving of the last GC and console log files. It does not affect Log4j configuration.-# This pre-startup rotation may need to be disabled depending how much you customize the default logging setup.-#SOLR_LOG_PRESTART_ROTATION=true+# Enables log rotation before starting Solr. Setting SOLR_LOG_PRESTART_ROTATION=true will let Solr take care of pre+# start rotation of logs. This is false by default as log4j2 handles this for us. If you choose to use another log+# framework that cannot do startup rotation, you may want to enable this to let Solr rotate logs on startup.+#SOLR_LOG_PRESTART_ROTATION=false# Sets the port Solr binds to, default is 8983#SOLR_PORT=8983diff --git a/solr/solr-ref-guide/src/configuring-logging.adoc b/solr/solr-ref-guide/src/configuring-logging.adocindex c6a3ad00b57..14bb0f04e69 100644--- a/solr/solr-ref-guide/src/configuring-logging.adoc+++ b/solr/solr-ref-guide/src/configuring-logging.adoc@@ -97,11 +97,9 @@ Also, in `log4j2.xml` if the default log rotation size threshold of 32MB is too<SizeBasedTriggeringPolicy size="100 MB"/>-----Java Garbage Collection logs are rotated by the JVM when size hits 20M, for a max of 9 generations. Old GC logs are moved to `SOLR_LOGS_DIR/archived`. These settings can only be changed by editing the start scripts.+Java Garbage Collection logs are rotated by the JVM when size hits 20M, for a max of 9 generations.-On every startup of Solr, the start script will clean up old logs and rotate the main `solr.log` file. If you changed the `<DefaultRolloverStrategy max="10"/>` setting in `log4j2.xml`, you also need to change the corresponding setting `-rotate_solr_logs 10` in the start script.--You can disable the automatic log rotation at startup by changing the setting `SOLR_LOG_PRESTART_ROTATION` found in `bin/solr.in.sh` or `bin/solr.in.cmd` to false.+On every startup or restart of Solr, log4j2 performs log rotation. If you choose to use another log framework that does not support rotation on startup, you may enable `SOLR_LOG_PRESTART_ROTATION` in `bin/solr.in.sh` or `bin/solr.in.cmd` to let the start script rotate the logs on startup.== Logging Slow Queries