Do not create two loggers for DeprecationLogger backport(#58435) (#61530)

DeprecationLogger's constructor should not create two loggers. It was
taking parent logger instance, changing its name with a .deprecation
prefix and creating a new logger.
Most of the time parent logger was not needed. It was causing Log4j to
unnecessarily cache the unused parent logger instance.

depends on #61515
backports #58435
This commit is contained in:
Przemyslaw Gomulka 2020-08-26 16:04:02 +02:00 committed by GitHub
parent 3a8cfdc1f5
commit 9f566644af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
162 changed files with 199 additions and 420 deletions

View File

@ -27,7 +27,6 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.nio.entity.NByteArrayEntity;
import org.apache.http.util.EntityUtils;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.DocWriteRequest;
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
@ -138,8 +137,7 @@ import static org.hamcrest.Matchers.nullValue;
public class RequestConvertersTests extends ESTestCase {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RequestConvertersTests.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RequestConvertersTests.class);
public void testPing() {
Request request = RequestConverters.ping();

View File

@ -19,7 +19,6 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.cjk.CJKBigramFilter;
import org.apache.lucene.analysis.miscellaneous.DisableGraphAttribute;
@ -52,8 +51,7 @@ import java.util.Set;
*/
public final class CJKBigramFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger DEPRECATION_LOGGER
= new DeprecationLogger(LogManager.getLogger(CJKBigramFilterFactory.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(CJKBigramFilterFactory.class);
private final int flags;
private final boolean outputUnigrams;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.CharArraySet;
import org.apache.lucene.analysis.StopFilter;
@ -157,7 +156,7 @@ import static org.elasticsearch.plugins.AnalysisPlugin.requiresAnalysisSettings;
public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, ScriptPlugin {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(CommonAnalysisPlugin.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(CommonAnalysisPlugin.class);
private final SetOnce<ScriptService> scriptService = new SetOnce<>();

View File

@ -19,7 +19,6 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.CharArraySet;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.commongrams.CommonGramsFilter;
@ -35,8 +34,7 @@ import org.elasticsearch.index.analysis.TokenFilterFactory;
public class CommonGramsTokenFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger DEPRECATION_LOGGER
= new DeprecationLogger(LogManager.getLogger(CommonGramsTokenFilterFactory.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(CommonGramsTokenFilterFactory.class);
private final CharArraySet words;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.ngram.EdgeNGramTokenFilter;
import org.apache.lucene.analysis.reverse.ReverseStringFilter;
@ -34,8 +33,7 @@ import org.elasticsearch.index.analysis.TokenFilterFactory;
public class EdgeNGramTokenFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger DEPRECATION_LOGGER
= new DeprecationLogger(LogManager.getLogger(EdgeNGramTokenFilterFactory.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(EdgeNGramTokenFilterFactory.class);
private final int minGram;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.miscellaneous.FingerprintFilter;
import org.elasticsearch.Version;
@ -35,8 +34,7 @@ import static org.elasticsearch.analysis.common.FingerprintAnalyzerProvider.MAX_
public class FingerprintTokenFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger DEPRECATION_LOGGER
= new DeprecationLogger(LogManager.getLogger(FingerprintTokenFilterFactory.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(FingerprintTokenFilterFactory.class);
private final char separator;
private final int maxOutputSize;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings;
@ -29,7 +28,7 @@ import org.elasticsearch.index.IndexSettings;
public class LegacyDelimitedPayloadTokenFilterFactory extends DelimitedPayloadTokenFilterFactory {
private static final DeprecationLogger deprecationLogger =
new DeprecationLogger(LogManager.getLogger(LegacyDelimitedPayloadTokenFilterFactory.class));
DeprecationLogger.getLogger(LegacyDelimitedPayloadTokenFilterFactory.class);
LegacyDelimitedPayloadTokenFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
super(indexSettings, env, name, settings);

View File

@ -19,7 +19,6 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.miscellaneous.ConditionalTokenFilter;
@ -44,8 +43,7 @@ import java.util.function.Function;
public class MultiplexerTokenFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger DEPRECATION_LOGGER
= new DeprecationLogger(LogManager.getLogger(MultiplexerTokenFilterFactory.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(MultiplexerTokenFilterFactory.class);
private List<String> filterNames;
private final boolean preserveOriginal;

View File

@ -19,22 +19,20 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.ngram.NGramTokenFilter;
import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.analysis.AbstractTokenFilterFactory;
import org.elasticsearch.Version;
import org.elasticsearch.index.analysis.TokenFilterFactory;
public class NGramTokenFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger DEPRECATION_LOGGER
= new DeprecationLogger(LogManager.getLogger(NGramTokenFilterFactory.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(NGramTokenFilterFactory.class);
private final int minGram;
private final int maxGram;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.CharArraySet;
import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationLogger;
@ -32,7 +31,7 @@ import org.elasticsearch.index.analysis.Analysis;
public class StandardHtmlStripAnalyzerProvider extends AbstractIndexAnalyzerProvider<StandardHtmlStripAnalyzer> {
private static final DeprecationLogger DEPRECATION_LOGGER =
new DeprecationLogger(LogManager.getLogger(StandardHtmlStripAnalyzerProvider.class));
DeprecationLogger.getLogger(StandardHtmlStripAnalyzerProvider.class);
private final StandardHtmlStripAnalyzer analyzer;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.synonym.SynonymFilter;
@ -43,8 +42,7 @@ import java.util.function.Function;
public class SynonymTokenFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger DEPRECATION_LOGGER
= new DeprecationLogger(LogManager.getLogger(SynonymTokenFilterFactory.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(SynonymTokenFilterFactory.class);
private final String format;
private final boolean expand;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.CharArraySet;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.miscellaneous.WordDelimiterGraphFilter;
@ -51,7 +50,7 @@ import static org.elasticsearch.analysis.common.WordDelimiterTokenFilterFactory.
public class WordDelimiterGraphTokenFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger DEPRECATION_LOGGER =
new DeprecationLogger(LogManager.getLogger(WordDelimiterGraphTokenFilterFactory.class));
DeprecationLogger.getLogger(WordDelimiterGraphTokenFilterFactory.class);
private final byte[] charTypeTable;
private final int flags;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.analysis.common;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.CharArraySet;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter;
@ -55,7 +54,7 @@ import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.STEM_
public class WordDelimiterTokenFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger DEPRECATION_LOGGER =
new DeprecationLogger(LogManager.getLogger(WordDelimiterTokenFilterFactory.class));
DeprecationLogger.getLogger(WordDelimiterTokenFilterFactory.class);
private final byte[] charTypeTable;
private final int flags;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.ingest.common;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.logging.DeprecationLogger;
@ -53,7 +52,7 @@ import static org.elasticsearch.ingest.ConfigurationUtils.newConfigurationExcept
public final class ScriptProcessor extends AbstractProcessor {
private static final DeprecationLogger deprecationLogger =
new DeprecationLogger(LogManager.getLogger(DynamicMap.class));
DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = org.elasticsearch.common.collect.Map.of(
"_type", value -> {
deprecationLogger.deprecate("script_processor",

View File

@ -19,7 +19,6 @@
package org.elasticsearch.ingest.useragent;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.ingest.AbstractProcessor;
import org.elasticsearch.ingest.IngestDocument;
@ -44,7 +43,7 @@ import static org.elasticsearch.ingest.ConfigurationUtils.readStringProperty;
public class UserAgentProcessor extends AbstractProcessor {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(UserAgentProcessor.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(UserAgentProcessor.class);
public static final String TYPE = "user_agent";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.script.mustache;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings;
@ -41,8 +40,7 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestMultiSearchTemplateAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestMultiSearchTemplateAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestMultiSearchTemplateAction.class);
static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
" Specifying types in multi search template requests is deprecated.";

View File

@ -32,9 +32,8 @@ import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.fielddata.IndexOrdinalsFieldData;
@ -86,8 +85,7 @@ public class HasChildQueryBuilder extends AbstractQueryBuilder<HasChildQueryBuil
private static final ParseField SCORE_MODE_FIELD = new ParseField("score_mode");
private static final ParseField INNER_HITS_FIELD = new ParseField("inner_hits");
private static final ParseField IGNORE_UNMAPPED_FIELD = new ParseField("ignore_unmapped");
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(HasChildQueryBuilder.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(HasChildQueryBuilder.class);
private final QueryBuilder query;
private final String type;
private final ScoreMode scoreMode;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.percolator;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.DelegatingAnalyzerWrapper;
import org.apache.lucene.index.BinaryDocValues;
@ -100,7 +99,7 @@ import static org.elasticsearch.search.SearchService.ALLOW_EXPENSIVE_QUERIES;
public class PercolateQueryBuilder extends AbstractQueryBuilder<PercolateQueryBuilder> {
public static final String NAME = "percolate";
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(ParseField.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(ParseField.class);
static final String DOCUMENT_TYPE_DEPRECATION_MESSAGE = "[types removal] Types are deprecated in [percolate] queries. " +
"The [document_type] should no longer be specified.";
static final String TYPE_DEPRECATION_MESSAGE = "[types removal] Types are deprecated in [percolate] queries. " +

View File

@ -19,8 +19,6 @@
package org.elasticsearch.index.reindex;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.util.automaton.Automata;
import org.apache.lucene.util.automaton.Automaton;
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
@ -44,8 +42,7 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import java.util.List;
class ReindexValidator {
private static final Logger logger = LogManager.getLogger(ReindexValidator.class);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(ReindexValidator.class);
static final String SORT_DEPRECATED_MESSAGE = "The sort option in reindex is deprecated. " +
"Instead consider using query filtering to find the desired subset of data.";

View File

@ -21,7 +21,6 @@ package org.elasticsearch.index.reindex.remote;
import org.apache.http.entity.ContentType;
import org.apache.http.nio.entity.NStringEntity;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.action.search.SearchRequest;
@ -55,8 +54,7 @@ import static org.elasticsearch.common.unit.TimeValue.timeValueMillis;
* because the version constants have been removed.
*/
final class RemoteRequestBuilders {
private static final DeprecationLogger DEPRECATION_LOGGER
= new DeprecationLogger(LogManager.getLogger(RemoteRequestBuilders.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(RemoteRequestBuilders.class);
static final String DEPRECATED_URL_ENCODED_INDEX_WARNING =
"Specifying index name using URL escaped index names for reindex from remote is deprecated. " +

View File

@ -22,8 +22,6 @@ package org.elasticsearch.index.analysis;
import com.ibm.icu.text.FilteredNormalizer2;
import com.ibm.icu.text.Normalizer2;
import com.ibm.icu.text.UnicodeSet;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.TokenStream;
import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationLogger;
@ -40,7 +38,7 @@ import org.elasticsearch.index.IndexSettings;
public class IcuNormalizerTokenFilterFactory extends AbstractTokenFilterFactory implements NormalizingTokenFilterFactory {
private static final DeprecationLogger deprecationLogger =
new DeprecationLogger(LogManager.getLogger(IcuNormalizerTokenFilterFactory.class));
DeprecationLogger.getLogger(IcuNormalizerTokenFilterFactory.class);
private final Normalizer2 normalizer;

View File

@ -30,7 +30,6 @@ import org.apache.commons.codec.language.bm.Languages.LanguageSet;
import org.apache.commons.codec.language.bm.NameType;
import org.apache.commons.codec.language.bm.PhoneticEngine;
import org.apache.commons.codec.language.bm.RuleType;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.phonetic.BeiderMorseFilter;
import org.apache.lucene.analysis.phonetic.DaitchMokotoffSoundexFilter;
@ -51,8 +50,7 @@ import java.util.List;
public class PhoneticTokenFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger DEPRECATION_LOGGER
= new DeprecationLogger(LogManager.getLogger(PhoneticTokenFilterFactory.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(PhoneticTokenFilterFactory.class);
private final Encoder encoder;
private final boolean replace;

View File

@ -44,7 +44,7 @@ public class AzureDiscoveryPlugin extends Plugin implements DiscoveryPlugin {
public static final String AZURE = "azure";
protected final Settings settings;
private static final Logger logger = LogManager.getLogger(AzureDiscoveryPlugin.class);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(AzureDiscoveryPlugin.class);
public AzureDiscoveryPlugin(Settings settings) {
this.settings = settings;

View File

@ -77,7 +77,7 @@ final class Ec2ClientSettings {
private static final Logger logger = LogManager.getLogger(Ec2ClientSettings.class);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(Ec2ClientSettings.class);
/** Credentials to authenticate with ec2. */
final AWSCredentials credentials;

View File

@ -71,7 +71,7 @@ import java.util.function.Function;
*/
class S3Repository extends BlobStoreRepository {
private static final Logger logger = LogManager.getLogger(S3Repository.class);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(logger.getName());
static final String TYPE = "s3";

View File

@ -108,7 +108,7 @@ public class EvilLoggerTests extends ESTestCase {
public void testConcurrentDeprecationLogger() throws IOException, UserException, BrokenBarrierException, InterruptedException {
setupLogging("deprecation");
final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger("deprecation"));
final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger("deprecation");
final int numberOfThreads = randomIntBetween(2, 4);
final CyclicBarrier barrier = new CyclicBarrier(1 + numberOfThreads);
@ -188,7 +188,7 @@ public class EvilLoggerTests extends ESTestCase {
public void testDeprecationLoggerMaybeLog() throws IOException, UserException {
setupLogging("deprecation");
final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger("deprecation"));
final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger("deprecation");
final int iterations = randomIntBetween(1, 16);

View File

@ -270,7 +270,7 @@ public class JsonLoggerTests extends ESTestCase {
public void testDuplicateLogMessages() throws IOException {
final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger("test"));
final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger("test");
// For the same key and X-Opaque-ID deprecation should be once
ThreadContext threadContext = new ThreadContext(Settings.EMPTY);

View File

@ -18,7 +18,6 @@
*/
package org.elasticsearch.action.admin.cluster.configuration;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.MasterNodeRequest;
@ -29,8 +28,8 @@ import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException;
import java.util.Arrays;
@ -47,8 +46,7 @@ import java.util.stream.StreamSupport;
*/
public class AddVotingConfigExclusionsRequest extends MasterNodeRequest<AddVotingConfigExclusionsRequest> {
public static final String DEPRECATION_MESSAGE = "nodeDescription is deprecated and will be removed, use nodeIds or nodeNames instead";
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(AddVotingConfigExclusionsRequest.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(AddVotingConfigExclusionsRequest.class);
private final String[] nodeDescriptions;
private final String[] nodeIds;
private final String[] nodeNames;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.admin.cluster.snapshots.restore;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.ElasticsearchGenerationException;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
@ -54,7 +53,7 @@ import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBo
*/
public class RestoreSnapshotRequest extends MasterNodeRequest<RestoreSnapshotRequest> implements ToXContentObject {
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(LogManager.getLogger(RestoreSnapshotRequest.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(RestoreSnapshotRequest.class);
private String snapshot;
private String repository;

View File

@ -18,7 +18,6 @@
*/
package org.elasticsearch.action.admin.indices.template.put;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.ElasticsearchGenerationException;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.Version;
@ -59,16 +58,16 @@ import java.util.Set;
import java.util.stream.Collectors;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS;
import static org.elasticsearch.common.settings.Settings.readSettingsFromStream;
import static org.elasticsearch.common.settings.Settings.writeSettingsToStream;
import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS;
/**
* A request to create an index template.
*/
public class PutIndexTemplateRequest extends MasterNodeRequest<PutIndexTemplateRequest> implements IndicesRequest, ToXContentObject {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(PutIndexTemplateRequest.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(PutIndexTemplateRequest.class);
private String name;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.bulk;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.DocWriteRequest;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.index.IndexRequest;
@ -53,7 +52,7 @@ import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_PRIMARY_T
*/
public final class BulkRequestParser {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(BulkRequestParser.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(BulkRequestParser.class);
private static final ParseField INDEX = new ParseField("_index");
private static final ParseField TYPE = new ParseField("_type");

View File

@ -19,8 +19,6 @@
package org.elasticsearch.action.ingest;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.common.bytes.BytesReference;
@ -46,9 +44,7 @@ import java.util.Objects;
public class SimulatePipelineRequest extends ActionRequest implements ToXContentObject {
private static final Logger logger = LogManager.getLogger(SimulatePipelineRequest.class);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(SimulatePipelineRequest.class);
private String id;
private boolean verbose;
private BytesReference source;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.termvectors;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
@ -63,8 +62,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
* required.
*/
public class TermVectorsRequest extends SingleShardRequest<TermVectorsRequest> implements RealtimeRequest {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(TermVectorsRequest.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(TermVectorsRequest.class);
private static final ParseField INDEX = new ParseField("_index");
private static final ParseField TYPE = new ParseField("_type");

View File

@ -19,20 +19,18 @@
package org.elasticsearch.bootstrap;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.appender.ConsoleAppender;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.lucene.util.Constants;
import org.elasticsearch.cli.KeyStoreAwareCommand;
import org.elasticsearch.cli.Terminal;
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.core.internal.io.IOUtils;
import org.apache.lucene.util.StringHelper;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.cli.KeyStoreAwareCommand;
import org.elasticsearch.cli.Terminal;
import org.elasticsearch.cli.UserException;
import org.elasticsearch.common.PidFile;
import org.elasticsearch.common.SuppressForbidden;
@ -43,8 +41,10 @@ import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.network.IfConfig;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.elasticsearch.common.settings.SecureSettings;
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.BoundTransportAddress;
import org.elasticsearch.core.internal.io.IOUtils;
import org.elasticsearch.env.Environment;
import org.elasticsearch.monitor.jvm.JvmInfo;
import org.elasticsearch.monitor.os.OsProbe;
@ -361,7 +361,7 @@ final class Bootstrap {
"future versions of Elasticsearch will require Java 11; " +
"your Java version from [%s] does not meet this requirement",
System.getProperty("java.home"));
new DeprecationLogger(LogManager.getLogger(Bootstrap.class)).deprecate("java_version_11_required", message);
DeprecationLogger.getLogger(Bootstrap.class).deprecate("java_version_11_required", message);
}
if (environment.pidFile() != null) {
try {

View File

@ -20,7 +20,6 @@ package org.elasticsearch.cluster.metadata;
import com.carrotsearch.hppc.cursors.ObjectCursor;
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.AbstractDiffable;
@ -54,7 +53,7 @@ import static org.elasticsearch.cluster.metadata.Metadata.CONTEXT_MODE_PARAM;
public class IndexTemplateMetadata extends AbstractDiffable<IndexTemplateMetadata> {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(IndexTemplateMetadata.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(IndexTemplateMetadata.class);
private final String name;

View File

@ -114,7 +114,7 @@ import static org.elasticsearch.cluster.metadata.MetadataCreateDataStreamService
*/
public class MetadataCreateIndexService {
private static final Logger logger = LogManager.getLogger(MetadataCreateIndexService.class);
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(logger);
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(MetadataCreateIndexService.class);
public static final int MAX_INDEX_NAME_BYTES = 255;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.cluster.routing;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetadata;
@ -52,7 +51,7 @@ public class OperationRouting {
Setting.boolSetting("cluster.routing.use_adaptive_replica_selection", true,
Setting.Property.Dynamic, Setting.Property.NodeScope);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(OperationRouting.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(OperationRouting.class);
private static final String IGNORE_AWARENESS_ATTRIBUTES_PROPERTY = "es.search.ignore_awareness_attributes";
static final String IGNORE_AWARENESS_ATTRIBUTES_DEPRECATION_MESSAGE =
"searches will not be routed based on awareness attributes starting in version 8.0.0; " +

View File

@ -73,7 +73,7 @@ public class DiskThresholdMonitor {
private final RerouteService rerouteService;
private final AtomicLong lastRunTimeMillis = new AtomicLong(Long.MIN_VALUE);
private final AtomicBoolean checkInProgress = new AtomicBoolean();
private final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
private final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(logger.getName());
/**
* The IDs of the nodes that were over the low threshold in the last check (and maybe over another threshold too). Tracked so that we

View File

@ -19,14 +19,12 @@
package org.elasticsearch.common.joda;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.Version;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.time.DateFormatter;
import org.elasticsearch.common.time.FormatNames;
import org.elasticsearch.common.util.LazyInitializable;
import org.elasticsearch.common.time.FormatNames;
import org.joda.time.Chronology;
import org.joda.time.DateTime;
import org.joda.time.DateTimeField;
@ -60,7 +58,7 @@ public class Joda {
// it results in errors sent to status logger and startup to fail.
// Hence a lazy initialization.
private static final LazyInitializable<DeprecationLogger, RuntimeException> deprecationLogger
= new LazyInitializable(() -> new DeprecationLogger(LogManager.getLogger(FormatNames.class)));
= new LazyInitializable(() -> DeprecationLogger.getLogger(Joda.class));
/**
* Parses a joda based pattern, including some named ones (similar to the built in Joda ISO ones).
*/

View File

@ -46,12 +46,19 @@ public class DeprecationLogger {
* it replaces "org.elasticsearch" with "org.elasticsearch.deprecation" to maintain
* the "org.elasticsearch" namespace.
*/
public DeprecationLogger(Logger parentLogger) {
deprecationLogger = new ThrottlingAndHeaderWarningLogger(deprecatedLoggerName(parentLogger));
private DeprecationLogger(Logger parentLogger) {
deprecationLogger = new ThrottlingAndHeaderWarningLogger(parentLogger);
}
private static Logger deprecatedLoggerName(Logger parentLogger) {
String name = parentLogger.getName();
public static DeprecationLogger getLogger(Class<?> aClass) {
return getLogger(toLoggerName(aClass));
}
public static DeprecationLogger getLogger(String name) {
return new DeprecationLogger(deprecatedLoggerName(name));
}
private static Logger deprecatedLoggerName(String name) {
if (name.startsWith("org.elasticsearch")) {
name = name.replace("org.elasticsearch.", "org.elasticsearch.deprecation.");
} else {
@ -60,6 +67,11 @@ public class DeprecationLogger {
return LogManager.getLogger(name);
}
private static String toLoggerName(final Class<?> cls) {
String canonicalName = cls.getCanonicalName();
return canonicalName != null ? canonicalName : cls.getName();
}
public static void setThreadContext(ThreadContext threadContext) {
HeaderWarning.setThreadContext(threadContext);
}

View File

@ -20,7 +20,6 @@
package org.elasticsearch.common.settings;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.util.SetOnce;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.Version;
@ -320,7 +319,7 @@ public final class Settings implements ToXContentFragment {
* {@link Setting} object constructed in, for example, {@link org.elasticsearch.env.Environment}.
*/
static class DeprecationLoggerHolder {
static DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(Settings.class));
static DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(Settings.class);
}
/**

View File

@ -19,7 +19,6 @@
package org.elasticsearch.common.time;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.logging.DeprecationLogger;
@ -62,8 +61,8 @@ public class DateFormatters {
// If LogManager.getLogger is called before logging config is loaded
// it results in errors sent to status logger and startup to fail.
// Hence a lazy initialization.
private static final LazyInitializable<DeprecationLogger, RuntimeException> deprecationLogger
= new LazyInitializable(() -> new DeprecationLogger(LogManager.getLogger(FormatNames.class)));
private static final LazyInitializable<DeprecationLogger, RuntimeException> deprecationLogger =
new LazyInitializable(() -> DeprecationLogger.getLogger(FormatNames.class));
private static final DateTimeFormatter TIME_ZONE_FORMATTER_NO_COLON = new DateTimeFormatterBuilder()
.appendOffset("+HHmm", "Z")

View File

@ -19,7 +19,6 @@
package org.elasticsearch.common.time;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.joda.time.DateTimeZone;
@ -51,7 +50,7 @@ public class DateUtils {
return DateTimeZone.forID(zoneId.getId());
}
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(DateFormatters.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DateUtils.class);
// pkg private for tests
static final Map<String, String> DEPRECATED_SHORT_TIMEZONES;
public static final Set<String> DEPRECATED_SHORT_TZ_IDS;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.common.unit;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.Version;
import org.elasticsearch.common.Strings;
@ -43,7 +42,7 @@ public class ByteSizeValue implements Writeable, Comparable<ByteSizeValue>, ToXC
* {@link ByteSizeValue} object constructed in, for example, settings in {@link org.elasticsearch.common.network.NetworkService}.
*/
static class DeprecationLoggerHolder {
static DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(ByteSizeValue.class));
static DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(ByteSizeValue.class);
}
public static final ByteSizeValue ZERO = new ByteSizeValue(0, ByteSizeUnit.BYTES);

View File

@ -19,7 +19,6 @@
package org.elasticsearch.common.util.concurrent;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.logging.DeprecationLogger;
@ -49,7 +48,7 @@ import java.util.stream.Collectors;
public class EsExecutors {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(EsExecutors.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(EsExecutors.class);
/**
* Setting to manually set the number of available processors. This setting is used to adjust thread pool sizes per node.

View File

@ -19,7 +19,6 @@
package org.elasticsearch.common.xcontent;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.logging.DeprecationLogger;
@ -44,7 +43,7 @@ public class LoggingDeprecationHandler implements DeprecationHandler {
* Changing that will require some research to make super duper
* sure it is safe.
*/
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(ParseField.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(ParseField.class);
private LoggingDeprecationHandler() {
// Singleton

View File

@ -19,7 +19,6 @@
package org.elasticsearch.http;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationLogger;
@ -34,7 +33,7 @@ import java.io.IOException;
public class HttpInfo implements ReportingService.Info {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(HttpInfo.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(HttpInfo.class);
/** Deprecated property, just here for deprecation logging in 7.x. */
private static final boolean CNAME_IN_PUBLISH_HOST = System.getProperty("es.http.cname_in_publish_address") != null;

View File

@ -34,7 +34,7 @@ public abstract class AbstractIndexComponent implements IndexComponent {
*/
protected AbstractIndexComponent(IndexSettings indexSettings) {
this.logger = Loggers.getLogger(getClass(), indexSettings.getIndex());
this.deprecationLogger = new DeprecationLogger(logger);
this.deprecationLogger = DeprecationLogger.getLogger(getClass());
this.indexSettings = indexSettings;
}

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.analysis;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.elasticsearch.Version;
@ -35,8 +34,7 @@ import java.util.function.Function;
*/
public final class PreConfiguredTokenFilter extends PreConfiguredAnalysisComponent<TokenFilterFactory> {
private static final DeprecationLogger DEPRECATION_LOGGER
= new DeprecationLogger(LogManager.getLogger(PreConfiguredTokenFilter.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(PreConfiguredTokenFilter.class);
/**
* Create a pre-configured token filter that may not vary at all.

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.analysis;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.miscellaneous.DisableGraphAttribute;
import org.apache.lucene.analysis.shingle.ShingleFilter;
@ -31,8 +30,7 @@ import org.elasticsearch.index.IndexSettings;
public class ShingleTokenFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger DEPRECATION_LOGGER =
new DeprecationLogger(LogManager.getLogger(ShingleTokenFilterFactory.class));
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(ShingleTokenFilterFactory.class);
private final Factory factory;

View File

@ -18,7 +18,6 @@
*/
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexOptions;
@ -150,7 +149,7 @@ public class CompletionFieldMapper extends ParametrizedFieldMapper {
private final NamedAnalyzer defaultAnalyzer;
private final Version indexVersionCreated;
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(Builder.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(Builder.class);
/**
* @param name of the completion field to build

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.Version;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.regex.Regex;
@ -36,7 +35,7 @@ import java.util.TreeMap;
public class DynamicTemplate implements ToXContentObject {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(DynamicTemplate.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicTemplate.class);
public enum MatchType {
SIMPLE {

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexOptions;
@ -44,8 +43,8 @@ import java.util.List;
*/
public class FieldNamesFieldMapper extends MetadataFieldMapper {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(FieldNamesFieldMapper.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(FieldNamesFieldMapper.class);
public static final String NAME = "_field_names";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexOptions;
@ -61,7 +60,7 @@ import java.util.List;
* queries.
*/
public class IdFieldMapper extends MetadataFieldMapper {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(IdFieldMapper.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(IdFieldMapper.class);
static final String ID_FIELD_DATA_DEPRECATION_MESSAGE =
"Loading the fielddata on the _id field is deprecated and will be removed in future versions. "
+ "If you require sorting or aggregating on this field you should also include the id in the "

View File

@ -18,8 +18,6 @@
*/
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.spatial.prefix.PrefixTreeStrategy;
@ -181,8 +179,7 @@ public class LegacyGeoShapeFieldMapper extends AbstractShapeGeometryFieldMapper<
}
}
private static final Logger logger = LogManager.getLogger(LegacyGeoShapeFieldMapper.class);
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(logger);
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(LegacyGeoShapeFieldMapper.class);
public static class Builder extends AbstractShapeGeometryFieldMapper.Builder<Builder,
LegacyGeoShapeFieldMapper.GeoShapeFieldType> {

View File

@ -20,7 +20,6 @@
package org.elasticsearch.index.mapper;
import com.carrotsearch.hppc.cursors.ObjectCursor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.DelegatingAnalyzerWrapper;
@ -125,7 +124,7 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"_id", IgnoredFieldMapper.NAME, "_index", "_routing", "_size", "_timestamp", "_ttl", "_type")));
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(MapperService.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(MapperService.class);
static final String DEFAULT_MAPPING_ERROR_MESSAGE = "[_default_] mappings are not allowed on new indices and should no " +
"longer be used. See [https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.html" +
"#default-mapping-not-allowed] for more information.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
@ -47,7 +46,7 @@ import java.util.Locale;
import java.util.Map;
public class ObjectMapper extends Mapper implements Cloneable {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(ObjectMapper.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(ObjectMapper.class);
public static final String CONTENT_TYPE = "object";
public static final String NESTED_CONTENT_TYPE = "nested";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.document.FieldType;
import org.elasticsearch.Version;
import org.elasticsearch.common.Explicit;
@ -60,8 +59,7 @@ import java.util.function.Supplier;
*/
public abstract class ParametrizedFieldMapper extends FieldMapper {
private static final DeprecationLogger deprecationLogger
= new DeprecationLogger(LogManager.getLogger(ParametrizedFieldMapper.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(ParametrizedFieldMapper.class);
/**
* Creates a new ParametrizedFieldMapper

View File

@ -19,8 +19,6 @@
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.Version;
import org.elasticsearch.common.Explicit;
import org.elasticsearch.common.Nullable;
@ -47,9 +45,7 @@ import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBo
import static org.elasticsearch.index.mapper.TypeParsers.parseDateTimeFormatter;
public class RootObjectMapper extends ObjectMapper {
private static final Logger LOGGER = LogManager.getLogger(RootObjectMapper.class);
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(LOGGER);
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(RootObjectMapper.class);
public static class Defaults {
public static final DateFormatter[] DYNAMIC_DATE_TIME_FORMATTERS =

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.index.IndexOptions;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.logging.DeprecationLogger;
@ -42,7 +41,7 @@ import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeFl
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeStringValue;
public class TypeParsers {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(TypeParsers.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(TypeParsers.class);
public static final String DOC_VALUES = "doc_values";
public static final String INDEX_OPTIONS_DOCS = "docs";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.query;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.search.ConstantScoreQuery;
import org.apache.lucene.search.Query;
import org.elasticsearch.common.Nullable;
@ -52,8 +51,7 @@ import java.util.function.Supplier;
*/
public class GeoShapeQueryBuilder extends AbstractGeometryQueryBuilder<GeoShapeQueryBuilder> {
public static final String NAME = "geo_shape";
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(GeoShapeQueryBuilder.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(GeoShapeQueryBuilder.class);
protected static final ParseField STRATEGY_FIELD = new ParseField("strategy");

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.query;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.search.MatchNoDocsQuery;
import org.apache.lucene.search.Query;
import org.elasticsearch.cluster.metadata.Metadata;
@ -52,8 +51,7 @@ import static org.elasticsearch.common.xcontent.ObjectParser.fromList;
*/
public class IdsQueryBuilder extends AbstractQueryBuilder<IdsQueryBuilder> {
public static final String NAME = "ids";
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(IdsQueryBuilder.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(IdsQueryBuilder.class);
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Types are deprecated in [ids] queries.";
private static final ParseField TYPE_FIELD = new ParseField("type");

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.query;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.index.Fields;
import org.apache.lucene.search.BooleanClause;
@ -80,8 +79,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
*/
public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder<MoreLikeThisQueryBuilder> {
public static final String NAME = "more_like_this";
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(MoreLikeThisQueryBuilder.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(MoreLikeThisQueryBuilder.class);
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Types are deprecated in [more_like_this] " +
"queries. The type should no longer be specified in the [like] and [unlike] sections.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.query;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.IndexSearcher;
@ -84,8 +83,7 @@ import static java.util.Collections.unmodifiableMap;
* Context object used to create lucene queries on the shard level.
*/
public class QueryShardContext extends QueryRewriteContext {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(QueryShardContext.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(QueryShardContext.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using the _type field " +
"in queries and aggregations is deprecated, prefer to use a field instead.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.query;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.search.MatchNoDocsQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.util.BytesRef;
@ -40,8 +39,7 @@ public class TypeQueryBuilder extends AbstractQueryBuilder<TypeQueryBuilder> {
public static final String NAME = "type";
private static final ParseField VALUE_FIELD = new ParseField("value");
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(TypeQueryBuilder.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(TypeQueryBuilder.class);
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Type queries are deprecated, " +
"prefer to filter on a field instead.";

View File

@ -18,7 +18,6 @@
*/
package org.elasticsearch.index.query.functionscore;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.Version;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.io.stream.StreamInput;
@ -39,9 +38,7 @@ import java.util.Objects;
* A function that computes a random score for the matched documents
*/
public class RandomScoreFunctionBuilder extends ScoreFunctionBuilder<RandomScoreFunctionBuilder> {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RandomScoreFunctionBuilder.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RandomScoreFunctionBuilder.class);
public static final String NAME = "random_score";
private String field;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.reindex;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.CompositeIndicesRequest;
import org.elasticsearch.action.index.IndexRequest;
@ -362,7 +361,7 @@ public class ReindexRequest extends AbstractBulkIndexByScrollRequest<ReindexRequ
static final ObjectParser<ReindexRequest, Void> PARSER = new ObjectParser<>("reindex");
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in reindex requests is deprecated.";
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(ReindexRequest.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(ReindexRequest.class);
static {
ObjectParser.Parser<ReindexRequest, Void> sourceParser = (parser, request, context) -> {

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.similarity;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.search.similarities.AfterEffect;
import org.apache.lucene.search.similarities.AfterEffectB;
import org.apache.lucene.search.similarities.AfterEffectL;
@ -67,7 +66,7 @@ final class SimilarityProviders {
private SimilarityProviders() {} // no instantiation
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(SimilarityProviders.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(SimilarityProviders.class);
static final String DISCOUNT_OVERLAPS = "discount_overlaps";
private static final Map<String, BasicModel> BASIC_MODELS;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.similarity;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.search.CollectionStatistics;
@ -50,8 +49,7 @@ import java.util.function.Function;
import java.util.function.Supplier;
public final class SimilarityService extends AbstractIndexComponent {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(SimilarityService.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(SimilarityService.class);
public static final String DEFAULT_SIMILARITY = "BM25";
private static final String CLASSIC_SIMILARITY = "classic";
private static final Map<String, Function<Version, Supplier<Similarity>>> DEFAULTS;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.indices.analysis;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.analysis.LowerCaseFilter;
import org.apache.lucene.analysis.TokenStream;
import org.elasticsearch.Version;
@ -71,8 +70,7 @@ public final class AnalysisModule {
}
private static final IndexSettings NA_INDEX_SETTINGS;
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(AnalysisModule.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(AnalysisModule.class);
private final HunspellService hunspellService;
private final AnalysisRegistry analysisRegistry;

View File

@ -79,7 +79,7 @@ public class SyncedFlushService implements IndexEventListener {
private static final Logger logger = LogManager.getLogger(SyncedFlushService.class);
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(logger);
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(logger.getName());
public static final String SYNCED_FLUSH_DEPRECATION_MESSAGE =
"Synced flush is deprecated and will be removed in 8.0. Use flush at _/flush or /{index}/_flush instead.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.ingest;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.script.DynamicMap;
import org.elasticsearch.script.IngestConditionalScript;
@ -47,8 +46,7 @@ import static org.elasticsearch.ingest.ConfigurationUtils.newConfigurationExcept
public class ConditionalProcessor extends AbstractProcessor implements WrappingProcessor {
private static final DeprecationLogger deprecationLogger =
new DeprecationLogger(LogManager.getLogger(DynamicMap.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> FUNCTIONS = org.elasticsearch.common.collect.Map.of(
"_type", value -> {
deprecationLogger.deprecate("conditional-processor__type",

View File

@ -64,7 +64,7 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestController implements HttpServerTransport.Dispatcher {
private static final Logger logger = LogManager.getLogger(RestController.class);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestController.class);
private static final BytesReference FAVICON_RESPONSE;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.admin.indices;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.client.node.NodeClient;
@ -41,8 +40,7 @@ import static java.util.Collections.singletonMap;
import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestCreateIndexAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestCreateIndexAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestCreateIndexAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using include_type_name in create " +
"index requests is deprecated. The parameter will be removed in the next major version.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.admin.indices;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.node.NodeClient;
@ -38,7 +37,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestForceMergeAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestForceMergeAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestForceMergeAction.class);
@Override
public List<Route> routes() {

View File

@ -49,7 +49,7 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetFieldMappingAction extends BaseRestHandler {
private static final Logger logger = LogManager.getLogger(RestGetFieldMappingAction.class);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(logger.getName());
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using include_type_name in get " +
"field mapping requests is deprecated. The parameter will be removed in the next major version.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.admin.indices;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest;
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
import org.elasticsearch.client.node.NodeClient;
@ -51,8 +50,7 @@ public class RestGetIndexTemplateAction extends BaseRestHandler {
private static final Set<String> RESPONSE_PARAMETERS = Collections.unmodifiableSet(Sets.union(
Collections.singleton(INCLUDE_TYPE_NAME_PARAMETER), Settings.FORMAT_PARAMS));
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestGetIndexTemplateAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestGetIndexTemplateAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
" Specifying include_type_name in get index template requests is deprecated.";

View File

@ -20,7 +20,6 @@
package org.elasticsearch.rest.action.admin.indices;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.node.NodeClient;
@ -48,7 +47,7 @@ import static org.elasticsearch.rest.RestRequest.Method.HEAD;
*/
public class RestGetIndicesAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetIndicesAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestGetIndicesAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using `include_type_name` in get indices requests"
+ " is deprecated. The parameter will be removed in the next major version.";

View File

@ -64,7 +64,7 @@ import static org.elasticsearch.rest.RestRequest.Method.HEAD;
public class RestGetMappingAction extends BaseRestHandler {
private static final Logger logger = LogManager.getLogger(RestGetMappingAction.class);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(logger.getName());
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using include_type_name in get" +
" mapping requests is deprecated. The parameter will be removed in the next major version.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.admin.indices;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
@ -42,8 +41,7 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestPutIndexTemplateAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestPutIndexTemplateAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestPutIndexTemplateAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
" Specifying include_type_name in put index template requests is deprecated."+
" The parameter will be removed in the next major version.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.admin.indices;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.node.NodeClient;
@ -43,8 +42,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestPutMappingAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestPutMappingAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestPutMappingAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using include_type_name in put " +
"mapping requests is deprecated. The parameter will be removed in the next major version.";

View File

@ -42,7 +42,7 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
public abstract class RestResizeHandler extends BaseRestHandler {
private static final Logger logger = LogManager.getLogger(RestResizeHandler.class);
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(logger.getName());
RestResizeHandler() {
}

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.admin.indices;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.client.node.NodeClient;
@ -37,8 +36,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestRolloverIndexAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestRolloverIndexAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestRolloverIndexAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using include_type_name in rollover " +
"index requests is deprecated. The parameter will be removed in the next major version.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.admin.indices;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.admin.indices.validate.query.QueryExplanation;
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
@ -46,8 +45,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.rest.RestStatus.OK;
public class RestValidateQueryAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestValidateQueryAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestValidateQueryAction.class);
static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
" Specifying types in validate query requests is deprecated.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.cat;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
@ -71,8 +70,7 @@ import static java.util.Collections.singletonList;
import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestNodesAction extends AbstractCatAction {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestNodesAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestNodesAction.class);
static final String LOCAL_DEPRECATED_MESSAGE = "Deprecated parameter [local] used. This parameter does not cause this API to act " +
"locally, and should not be used. It will be unsupported in version 8.0.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.document;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.DocWriteRequest;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkShardRequest;
@ -55,7 +54,7 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestBulkAction extends BaseRestHandler {
private final boolean allowExplicitIndex;
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestSearchAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestSearchAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
" Specifying types in bulk requests is deprecated.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.document;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.client.node.NodeClient;
@ -38,8 +37,7 @@ import static java.util.Collections.unmodifiableList;
import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestDeleteAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestDeleteAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestDeleteAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in " +
"document index requests is deprecated, use the /{index}/_doc/{id} endpoint instead.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.document;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.node.NodeClient;
@ -44,8 +43,7 @@ import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestGetAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestGetAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in " +
"document get requests is deprecated, use the /{index}/_doc/{id} endpoint instead.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.document;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.ResourceNotFoundException;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.get.GetRequest;
@ -52,7 +51,7 @@ import static org.elasticsearch.rest.RestStatus.OK;
*/
public class RestGetSourceAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetSourceAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestGetSourceAction.class);
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in get_source and exist_source"
+ "requests is deprecated.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.document;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.Version;
import org.elasticsearch.action.DocWriteRequest;
import org.elasticsearch.action.index.IndexRequest;
@ -45,8 +44,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestIndexAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestDeleteAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestDeleteAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in document " +
"index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, " +
"or /{index}/_create/{id}).";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.document;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.get.MultiGetRequest;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
@ -40,8 +39,7 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestMultiGetAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestMultiGetAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestMultiGetAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
" Specifying types in multi get requests is deprecated.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.document;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.termvectors.MultiTermVectorsRequest;
import org.elasticsearch.action.termvectors.TermVectorsRequest;
import org.elasticsearch.client.node.NodeClient;
@ -39,8 +38,7 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestMultiTermVectorsAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestTermVectorsAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestTermVectorsAction.class);
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] " +
"Specifying types in multi term vector requests is deprecated.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.document;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.termvectors.TermVectorsRequest;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
@ -47,8 +46,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
* TermVectorsRequest.
*/
public class RestTermVectorsAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestTermVectorsAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestTermVectorsAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] " +
"Specifying types in term vector requests is deprecated.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.document;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.DocWriteRequest;
import org.elasticsearch.action.index.IndexRequest;
@ -43,7 +42,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestUpdateAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger =
new DeprecationLogger(LogManager.getLogger(RestUpdateAction.class));
DeprecationLogger.getLogger(RestUpdateAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in " +
"document update requests is deprecated, use the endpoint /{index}/_update/{id} instead.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.search;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.IndicesOptions;
@ -47,8 +46,7 @@ import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHead
import static org.elasticsearch.search.internal.SearchContext.DEFAULT_TERMINATE_AFTER;
public class RestCountAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestCountAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestCountAction.class);
static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
" Specifying types in count requests is deprecated.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.search;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.explain.ExplainRequest;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
@ -43,8 +42,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
* Rest action for computing a score explanation for specific documents.
*/
public class RestExplainAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestExplainAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestExplainAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] " +
"Specifying a type in explain requests is deprecated.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.search;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.search.MultiSearchAction;
import org.elasticsearch.action.search.MultiSearchRequest;
import org.elasticsearch.action.search.SearchRequest;
@ -53,8 +52,7 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestMultiSearchAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestMultiSearchAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestMultiSearchAction.class);
static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
" Specifying types in multi search requests is deprecated.";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest.action.search;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.search.SearchAction;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.support.IndicesOptions;
@ -72,7 +71,7 @@ public class RestSearchAction extends BaseRestHandler {
RESPONSE_PARAMS = Collections.unmodifiableSet(responseParams);
}
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestSearchAction.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestSearchAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
" Specifying types in search requests is deprecated.";

View File

@ -18,7 +18,6 @@
*/
package org.elasticsearch.script;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.Scorable;
import org.elasticsearch.ElasticsearchException;
@ -36,8 +35,7 @@ import java.util.function.Function;
abstract class AbstractSortScript implements ScorerAware {
private static final DeprecationLogger deprecationLogger =
new DeprecationLogger(LogManager.getLogger(DynamicMap.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = org.elasticsearch.common.collect.Map.of(
"doc", value -> {
deprecationLogger.deprecate("sort-script_doc",

View File

@ -18,7 +18,6 @@
*/
package org.elasticsearch.script;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.Scorable;
import org.elasticsearch.ElasticsearchException;
@ -40,8 +39,7 @@ public abstract class AggregationScript implements ScorerAware {
public static final ScriptContext<Factory> CONTEXT = new ScriptContext<>("aggs", Factory.class);
private static final DeprecationLogger deprecationLogger =
new DeprecationLogger(LogManager.getLogger(DynamicMap.class));
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DynamicMap.class);
private static final Map<String, Function<Object, Object>> PARAMS_FUNCTIONS = org.elasticsearch.common.collect.Map.of(
"doc", value -> {
deprecationLogger.deprecate("aggregation-script_doc",

Some files were not shown because too many files have changed in this diff Show More