You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2018/04/03 11:11:29 UTC

lucene-solr:master: SOLR-12144: SOLR_LOG_PRESTART_ROTATION now defaults to false, we leverage log4j2 for log rotation on startup

Repository: lucene-solr
Updated Branches:
  refs/heads/master 00eab54f9 -> 0989e5874


SOLR-12144: SOLR_LOG_PRESTART_ROTATION now defaults to false, we leverage log4j2 for log rotation on startup


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/0989e587
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/0989e587
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/0989e587

Branch: refs/heads/master
Commit: 0989e5874a347bde14cae603a169cbcd31667251
Parents: 00eab54
Author: Jan Høydahl <ja...@apache.org>
Authored: Tue Apr 3 01:16:38 2018 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Tue Apr 3 13:10:20 2018 +0200

----------------------------------------------------------------------
 solr/CHANGES.txt                                 | 13 ++++++++-----
 solr/bin/solr                                    | 10 ++++++----
 solr/bin/solr.cmd                                | 11 ++++++-----
 solr/bin/solr.in.cmd                             |  8 ++++----
 solr/bin/solr.in.sh                              |  8 ++++----
 solr/solr-ref-guide/src/configuring-logging.adoc |  6 ++----
 6 files changed, 30 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0989e587/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f99bd39..d7a01f6 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 replication
   handler configuration, or pass it to the fetchindex command.
 
 New Features
@@ -75,7 +76,7 @@ New Features
   atomic.<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 Fixes
   document. 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 up
   trigger 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.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0989e587/solr/bin/solr
----------------------------------------------------------------------
diff --git a/solr/bin/solr b/solr/bin/solr
index 6487540..75e311e 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -1819,10 +1819,12 @@ if $verbose ; then
 else
   q="-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"
 fi
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0989e587/solr/bin/solr.cmd
----------------------------------------------------------------------
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index 15c4b50..54e3f7d 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 rotation
 IF [%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"
 )
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0989e587/solr/bin/solr.in.cmd
----------------------------------------------------------------------
diff --git a/solr/bin/solr.in.cmd b/solr/bin/solr.in.cmd
index 6f7867f..0962510 100644
--- a/solr/bin/solr.in.cmd
+++ b/solr/bin/solr.in.cmd
@@ -84,10 +84,10 @@ REM set SOLR_LOG_LEVEL=INFO
 REM Location where Solr should write logs to. Absolute or relative to solr start dir
 REM 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=false
 
 REM 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!

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0989e587/solr/bin/solr.in.sh
----------------------------------------------------------------------
diff --git a/solr/bin/solr.in.sh b/solr/bin/solr.in.sh
index d023b38..685882a 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=8983

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0989e587/solr/solr-ref-guide/src/configuring-logging.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/configuring-logging.adoc b/solr/solr-ref-guide/src/configuring-logging.adoc
index c6a3ad0..14bb0f0 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