diff --git a/solr/bin/solr b/solr/bin/solr index 0c0dc007e48..6df002eaf22 100755 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -1051,26 +1051,9 @@ if [[ -n ${SOLR_DATA_HOME:-} ]] && [ ! -e "$SOLR_DATA_HOME" ]; then exit 1 fi -# Establish default GC logging opts if no env var set (otherwise init to sensible default) +# Establish default GC logging opts if no env var set if [ -z "${GC_LOG_OPTS}" ]; then - GC_LOG_OPTS=('-Xlog:gc*') -fi - -# if verbose gc logging enabled, setup the location of the log file and rotation -if [ "${#GC_LOG_OPTS[@]}" -gt 0 ]; then - if [ "$JAVA_VENDOR" == "OpenJ9" ]; then - GC_LOG_OPTS+=("-Xverbosegclog:$SOLR_LOGS_DIR/solr_gc.log" '-XX:+UseGCLogFileRotation' '-XX:NumberOfGCLogFiles=9' '-XX:GCLogFileSize=20M') - else - # https://openjdk.java.net/jeps/158 - for i in "${!GC_LOG_OPTS[@]}"; - do - # for simplicity, we only look at the prefix '-Xlog:gc' - # (if 'all' or multiple tags are used starting with anything other then 'gc' the user is on their own) - # if a single additional ':' exists in param, then there is already an explicit output specifier - # shellcheck disable=SC2001 - GC_LOG_OPTS[$i]=$(echo "${GC_LOG_OPTS[$i]}" | sed "s|^\(-Xlog:gc[^:]*$\)|\1:file=$SOLR_LOGS_DIR/solr_gc.log:time,uptime:filecount=9,filesize=20M|") - done - fi + GC_LOG_OPTS=("-Xlog:gc*:file=$SOLR_LOGS_DIR/solr_gc.log:time,level,tags:filecount=9,filesize=20M") fi if [ "${SOLR_MODE:-}" == 'solrcloud' ]; then diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd index 7541e2183ac..b153b4bb086 100755 --- a/solr/bin/solr.cmd +++ b/solr/bin/solr.cmd @@ -1033,7 +1033,7 @@ REM Add vector optimizations module set SCRIPT_SOLR_OPTS=%SCRIPT_SOLR_OPTS% --add-modules jdk.incubator.vector IF "%GC_LOG_OPTS%"=="" ( - set GC_LOG_OPTS="-Xlog:gc*" + set GC_LOG_OPTS="-Xlog:gc*:file=!SOLR_LOGS_DIR!\solr_gc.log:time,level,tags:filecount=9,filesize=20M" ) IF "%verbose%"=="1" ( diff --git a/solr/bin/solr.in.cmd b/solr/bin/solr.in.cmd index ac058eae131..60a16216c44 100755 --- a/solr/bin/solr.in.cmd +++ b/solr/bin/solr.in.cmd @@ -39,9 +39,8 @@ REM Increase Java Min/Max Heap as needed to support your indexing / query needs REM set SOLR_JAVA_MEM=-Xms512m -Xmx512m REM Configure verbose GC logging: -REM For Java 8: if this is set, additional params will be added to specify the log file & rotation -REM For Java 9 or higher: GC_LOG_OPTS is currently not supported unless you are using OpenJ9. Otherwise if you set it, the startup script will exit with failure. -REM set GC_LOG_OPTS=-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime +REM Settings this value overrides the default configuration. +REM set GC_LOG_OPTS=-Xlog:gc*:time,level,tags,heap,tenuring,stop:filecount=9,filesize=20M REM Various GC settings have shown to work well for a number of common Solr workloads. REM See solr.cmd GC_TUNE for the default list. diff --git a/solr/bin/solr.in.sh b/solr/bin/solr.in.sh index 9d83a48c1c2..1834f29668c 100644 --- a/solr/bin/solr.in.sh +++ b/solr/bin/solr.in.sh @@ -39,15 +39,9 @@ #SOLR_JAVA_MEM="-Xms512m -Xmx512m" # Enable verbose GC logging... -# * If this is unset, various default options will be selected depending on which JVM version is in use -# * For Java 8: if this is set, additional params will be added to specify the log file & rotation -# * For Java 9 or higher: each included opt param that starts with '-Xlog:gc', but does not include an -# output specifier, will have a 'file' output specifier (as well as formatting & rollover options) -# appended, using the effective value of the SOLR_LOGS_DIR. +# If this is unset, various default options will be selected depending on which JVM version is in use # -#GC_LOG_OPTS='-Xlog:gc*' # (Java 9+) -#GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \ -# -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime" +#GC_LOG_OPTS='-Xlog:gc*:time,level,tags,heap,tenuring,stop:filecount=9,filesize=20M' # These GC settings have shown to work well for a number of common Solr workloads #GC_TUNE=" \