diff --git a/lucene/ivy-versions.properties b/lucene/ivy-versions.properties index 24c61c93e53..f19e33d5a31 100644 --- a/lucene/ivy-versions.properties +++ b/lucene/ivy-versions.properties @@ -84,11 +84,6 @@ io.prometheus.version = 0.2.0 /joda-time/joda-time = 2.2 /junit/junit = 4.10 -# NOTE: split out from the full version to also use as solr-ref-guide attribute -org.log4j.major.version = 2.11 -org.log4j.minor.version = 0 -org.apache.logging.log4j.version = ${org.log4j.major.version}.${org.log4j.minor.version} - /mecab/mecab-ipadic = 2.7.0-20070801 /mecab/mecab-naist-jdic = 0.6.3b-20111013 /net.arnx/jsonic = 1.2.7 @@ -182,6 +177,7 @@ org.apache.james.apache.mime4j.version = 0.8.1 /org.apache.james/apache-mime4j-core = ${org.apache.james.apache.mime4j.version} /org.apache.james/apache-mime4j-dom = ${org.apache.james.apache.mime4j.version} +org.apache.logging.log4j.version = 2.11.0 /org.apache.logging.log4j/log4j-1.2-api = ${org.apache.logging.log4j.version} /org.apache.logging.log4j/log4j-api = ${org.apache.logging.log4j.version} /org.apache.logging.log4j/log4j-core = ${org.apache.logging.log4j.version} diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 33525c5de14..1d1a3ff0ce0 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -52,7 +52,9 @@ Jetty 9.4.8.v20171121 Upgrade Notes ---------------------- -* SOLR-7887: Solr now uses Log4J 2.11. The log4j configuration is now in log4j2.xml rather than lo4j.properties files +* 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. New Features ---------------------- diff --git a/solr/contrib/prometheus-exporter/conf/log4j.properties b/solr/contrib/prometheus-exporter/conf/log4j.properties deleted file mode 100644 index 5dd689960d6..00000000000 --- a/solr/contrib/prometheus-exporter/conf/log4j.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -log4j.rootLogger=INFO, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd'T'HH:mm:ss.SSS} %-5p [%c] - %m%n diff --git a/solr/contrib/prometheus-exporter/conf/log4j2.xml b/solr/contrib/prometheus-exporter/conf/log4j2.xml new file mode 100644 index 00000000000..434c9766db6 --- /dev/null +++ b/solr/contrib/prometheus-exporter/conf/log4j2.xml @@ -0,0 +1,53 @@ + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n + + + + + + + + + + + + + + + + + + + diff --git a/solr/contrib/prometheus-exporter/src/test-files/conf/log4j.properties b/solr/contrib/prometheus-exporter/src/test-files/conf/log4j.properties deleted file mode 100644 index 5dd689960d6..00000000000 --- a/solr/contrib/prometheus-exporter/src/test-files/conf/log4j.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -log4j.rootLogger=INFO, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd'T'HH:mm:ss.SSS} %-5p [%c] - %m%n diff --git a/solr/contrib/prometheus-exporter/src/test-files/conf/log4j2.xml b/solr/contrib/prometheus-exporter/src/test-files/conf/log4j2.xml new file mode 100644 index 00000000000..5b31a73a415 --- /dev/null +++ b/solr/contrib/prometheus-exporter/src/test-files/conf/log4j2.xml @@ -0,0 +1,35 @@ + + + + + + + + + %d{yyyy-MM-dd'T'HH:mm:ss.SSS} %-5p [%c] - %m%n + + + + + + + + + + + diff --git a/solr/solr-ref-guide/src/_config.yml.template b/solr/solr-ref-guide/src/_config.yml.template index 41d25f46802..23c6b5c5fe4 100755 --- a/solr/solr-ref-guide/src/_config.yml.template +++ b/solr/solr-ref-guide/src/_config.yml.template @@ -80,7 +80,7 @@ solr-attributes: &solr-attributes-ref build-year: "${current.year}" ivy-commons-codec-version: "${ivyversions./commons-codec/commons-codec}" ivy-dropwizard-version: "${ivyversions.io.dropwizard.metrics.version}" - ivy-log4j-version: "${ivyversions.org.log4j.major.version}" + ivy-log4j-version: "${ivyversions.org.apache.logging.log4j.version}" ivy-opennlp-version: "${ivyversions./org.apache.opennlp/opennlp-tools}" ivy-tika-version: "${ivyversions.org.apache.tika.version}" ivy-velocity-tools-version: "${ivyversions./org.apache.velocity/velocity-tools}" diff --git a/solr/solr-ref-guide/src/configuring-logging.adoc b/solr/solr-ref-guide/src/configuring-logging.adoc index af8db2732d5..c6a3ad00b57 100644 --- a/solr/solr-ref-guide/src/configuring-logging.adoc +++ b/solr/solr-ref-guide/src/configuring-logging.adoc @@ -84,7 +84,7 @@ bin/solr start -f -q == Permanent Logging Settings -Solr uses http://logging.apache.org/log4j/{ivy-log4j-version}/[Log4J version {ivy-log4j-version}] for logging which is configured using `server/resources/log4j2.xml`. Take a moment to inspect the contents of the `log4j2.xml` file so that you are familiar with its structure. By default, Solr log messages will be written to `SOLR_LOGS_DIR/solr.log`. +Solr uses http://logging.apache.org/log4j/log4j-{ivy-log4j-version}/[Log4J version {ivy-log4j-version}] for logging which is configured using `server/resources/log4j2.xml`. Take a moment to inspect the contents of the `log4j2.xml` file so that you are familiar with its structure. By default, Solr log messages will be written to `SOLR_LOGS_DIR/solr.log`. When you're ready to deploy Solr in production, set the variable `SOLR_LOGS_DIR` to the location where you want Solr to write log files, such as `/var/solr/logs`. You may also want to tweak `log4j2.xml`. Note that if you installed Solr as a service using the instructions provided in <>, then see `/var/solr/log4j2.xml` instead of the default `server/resources` version. @@ -94,12 +94,12 @@ Also, in `log4j2.xml` if the default log rotation size threshold of 32MB is too [source,text] ---- -log4j.appender.file.MaxFileSize=100MB + ---- 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. -On every startup of Solr, the start script will clean up old logs and rotate the main `solr.log` file. If you changed the `log4j.appender.file.MaxBackupIndex` setting in `log4j2.xml`, you also need to change the corresponding setting `-rotate_solr_logs 10` in the start script. +On every startup of Solr, the start script will clean up old logs and rotate the main `solr.log` file. If you changed the `` 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.