Skip to content

Commit

Permalink
Remove unused deprecation loggers (elastic#119129)
Browse files Browse the repository at this point in the history
It's in the title, just noticed a bunch of these have become unused over time.
  • Loading branch information
original-brownbear authored Dec 19, 2024
1 parent 2c5bcdd commit 97a3540
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ public class StemmerTokenFilterFactory extends AbstractTokenFilterFactory {

private final String language;

private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(StemmerTokenFilterFactory.class);

StemmerTokenFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) throws IOException {
super(name);
this.language = Strings.capitalize(settings.get("language", settings.get("name", "porter")));
Expand Down Expand Up @@ -192,7 +190,7 @@ public boolean incrementToken() {
} else if ("german".equalsIgnoreCase(language)) {
return new SnowballFilter(tokenStream, new GermanStemmer());
} else if ("german2".equalsIgnoreCase(language)) {
DEPRECATION_LOGGER.critical(
deprecationLogger.critical(
DeprecationCategory.ANALYSIS,
"german2_stemmer_deprecation",
"The 'german2' stemmer has been deprecated and folded into the 'german' Stemmer. "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.synonym.SynonymFilter;
import org.apache.lucene.analysis.synonym.SynonymMap;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexService.IndexCreationContext;
Expand Down Expand Up @@ -130,8 +129,6 @@ public static SynonymsSource fromSettings(Settings settings) {
}
}

private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(SynonymTokenFilterFactory.class);

private final String format;
private final boolean expand;
private final boolean lenient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.lucene.uid.Versions;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.index.VersionType;
Expand Down Expand Up @@ -52,7 +51,6 @@ public class MultiGetRequest extends ActionRequest
CompositeIndicesRequest,
RealtimeRequest,
ToXContentObject {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(MultiGetRequest.class);

private static final ParseField DOCS = new ParseField("docs");
private static final ParseField INDEX = new ParseField("_index");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.index.mapper.IgnoredFieldMapper;
import org.elasticsearch.index.mapper.IgnoredSourceFieldMapper;
Expand All @@ -42,7 +41,6 @@
import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO;

public class GetResult implements Writeable, Iterable<DocumentField>, ToXContentObject {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(GetResult.class);

public static final String _INDEX = "_index";
public static final String _ID = "_id";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.apache.lucene.search.suggest.document.RegexCompletionQuery;
import org.apache.lucene.search.suggest.document.SuggestField;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.unit.Fuzziness;
import org.elasticsearch.common.util.Maps;
import org.elasticsearch.index.IndexVersion;
Expand Down Expand Up @@ -156,8 +155,6 @@ public static class Builder extends FieldMapper.Builder {
private final NamedAnalyzer defaultAnalyzer;
private final IndexVersion indexVersionCreated;

private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(Builder.class);

/**
* @param name of the completion field to build
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags.Flag;
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.Scope;
Expand All @@ -39,8 +38,6 @@

@ServerlessScope(Scope.INTERNAL)
public class RestNodesStatsAction extends BaseRestHandler {
private final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestNodesStatsAction.class);
private static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in nodes stats requests is deprecated.";

@Override
public List<Route> routes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.Scope;
import org.elasticsearch.rest.ServerlessScope;
import org.elasticsearch.rest.action.RestCancellableNodeClient;
import org.elasticsearch.rest.action.RestRefCountedChunkedToXContentListener;
import org.elasticsearch.rest.action.document.RestMultiTermVectorsAction;

import java.io.IOException;
import java.util.Collections;
Expand All @@ -39,9 +37,6 @@

@ServerlessScope(Scope.INTERNAL)
public class RestIndicesStatsAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestMultiTermVectorsAction.class);
private static final String TYPES_DEPRECATION_MESSAGE = "[types removal] "
+ "Specifying types in indices stats requests is deprecated.";

@Override
public List<Route> routes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest;
Expand All @@ -34,9 +33,6 @@

@ServerlessScope(Scope.PUBLIC)
public class RestPutMappingAction extends BaseRestHandler {
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in put mapping request is deprecated. "
+ "Use typeless api instead";
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestPutMappingAction.class);

@Override
public List<Route> routes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestRequest;
Expand All @@ -36,8 +35,6 @@

@ServerlessScope(Scope.PUBLIC)
public class RestValidateQueryAction extends BaseRestHandler {
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.";

@Override
public List<Route> routes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.elasticsearch.common.io.stream.DelayableWriteable;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.search.aggregations.Aggregator.BucketComparator;
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation.Bucket;
import org.elasticsearch.search.aggregations.bucket.terms.BucketAndOrd;
Expand Down Expand Up @@ -559,7 +558,6 @@ public static void writeHistogramOrder(BucketOrder order, StreamOutput out) thro
* Contains logic for parsing a {@link BucketOrder} from a {@link XContentParser}.
*/
public static class Parser {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(Parser.class);

/**
* Parse a {@link BucketOrder} from {@link XContent}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.common.Rounding;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories;
Expand All @@ -30,7 +29,6 @@
import java.util.Map;

public final class DateHistogramAggregatorFactory extends ValuesSourceAggregatorFactory {
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(DateHistogramAggregatorFactory.class);

public static void registerAggregators(ValuesSourceRegistry.Builder builder) {
builder.register(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.xcontent.ObjectParser;
import org.elasticsearch.xcontent.ParseField;
Expand All @@ -34,9 +33,6 @@
* - Provides a variety of helper methods to interpret the intervals as different types, depending on caller's need
*/
public class DateIntervalWrapper implements ToXContentFragment, Writeable {
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(DateHistogramAggregationBuilder.class);
private static final String DEPRECATION_TEXT = "[interval] on [date_histogram] is deprecated, use [fixed_interval] or "
+ "[calendar_interval] in the future.";
private static final ParseField FIXED_INTERVAL_FIELD = new ParseField("fixed_interval");
private static final ParseField CALENDAR_INTERVAL_FIELD = new ParseField("calendar_interval");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.protocol.xpack.graph.GraphExploreRequest;
import org.elasticsearch.protocol.xpack.graph.GraphExploreRequest.TermBoost;
Expand Down Expand Up @@ -42,10 +41,6 @@
@ServerlessScope(Scope.PUBLIC)
public class RestGraphAction extends BaseRestHandler {

private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestGraphAction.class);
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" + " Specifying types in graph requests is deprecated.";
private static final String URI_BASE = "/_xpack";

public static final ParseField TIMEOUT_FIELD = new ParseField("timeout");
public static final ParseField SIGNIFICANCE_FIELD = new ParseField("use_significance");
public static final ParseField RETURN_DETAILED_INFO = new ParseField("return_detailed_stats");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,6 @@ private boolean usingGlobalCatalog(LDAPConnection ldapConnection) {
*/
static class UpnADAuthenticator extends ADAuthenticator {
static final String UPN_USER_FILTER = "(&(objectClass=user)(userPrincipalName={1}))";
private final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(logger.getName());

UpnADAuthenticator(
RealmConfig config,
Expand All @@ -725,13 +724,17 @@ static class UpnADAuthenticator extends ADAuthenticator {
bindRequestSupplier
);
if (userSearchFilter.contains("{0}")) {
deprecationLogger.warn(
DeprecationCategory.SECURITY,
"ldap_settings",
"The use of the account name variable {0} in the setting ["
+ RealmSettings.getFullSettingKey(config, ActiveDirectorySessionFactorySettings.AD_UPN_USER_SEARCH_FILTER_SETTING)
+ "] has been deprecated and will be removed in a future version!"
);
DeprecationLogger.getLogger(logger.getName())
.warn(
DeprecationCategory.SECURITY,
"ldap_settings",
"The use of the account name variable {0} in the setting ["
+ RealmSettings.getFullSettingKey(
config,
ActiveDirectorySessionFactorySettings.AD_UPN_USER_SEARCH_FILTER_SETTING
)
+ "] has been deprecated and will be removed in a future version!"
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public abstract class SessionFactory implements Closeable, ReloadableSecurityCom
private static final Pattern STARTS_WITH_LDAP = Pattern.compile("^ldap:.*", Pattern.CASE_INSENSITIVE);

protected final Logger logger;
protected final DeprecationLogger deprecationLogger;
protected final RealmConfig config;
protected final TimeValue timeout;
protected final SSLService sslService;
Expand All @@ -71,7 +70,6 @@ public abstract class SessionFactory implements Closeable, ReloadableSecurityCom
protected SessionFactory(RealmConfig config, SSLService sslService, ThreadPool threadPool) {
this.config = config;
this.logger = LogManager.getLogger(getClass());
this.deprecationLogger = DeprecationLogger.getLogger(logger.getName());
TimeValue searchTimeout = config.getSetting(
SessionFactorySettings.TIMEOUT_LDAP_SETTING,
() -> SessionFactorySettings.TIMEOUT_DEFAULT
Expand Down

0 comments on commit 97a3540

Please sign in to comment.