Use more specific loggers in subclasses of TMNA (#50076)

Adjusts the subclasses of `TransportMasterNodeAction` to use their own loggers
instead of the one for the base class.

Relates #50056.
Partial backport of #46431 to 7.x.
This commit is contained in:
David Turner 2019-12-11 15:07:47 +00:00 committed by GitHub
parent 8ff809af2d
commit 285eacd267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 125 additions and 1 deletions

View File

@ -19,6 +19,8 @@
package org.elasticsearch.action.admin.cluster.allocation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
@ -55,6 +57,8 @@ import java.util.List;
public class TransportClusterAllocationExplainAction
extends TransportMasterNodeAction<ClusterAllocationExplainRequest, ClusterAllocationExplainResponse> {
private static final Logger logger = LogManager.getLogger(TransportClusterAllocationExplainAction.class);
private final ClusterInfoService clusterInfoService;
private final AllocationDeciders allocationDeciders;
private final ShardsAllocator shardAllocator;

View File

@ -18,6 +18,8 @@
*/
package org.elasticsearch.action.admin.cluster.configuration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchTimeoutException;
import org.elasticsearch.action.ActionListener;
@ -52,6 +54,8 @@ import java.util.stream.Collectors;
public class TransportAddVotingConfigExclusionsAction extends TransportMasterNodeAction<AddVotingConfigExclusionsRequest,
AddVotingConfigExclusionsResponse> {
private static final Logger logger = LogManager.getLogger(TransportAddVotingConfigExclusionsAction.class);
public static final Setting<Integer> MAXIMUM_VOTING_CONFIG_EXCLUSIONS_SETTING
= Setting.intSetting("cluster.max_voting_config_exclusions", 10, 1, Property.Dynamic, Property.NodeScope);

View File

@ -18,6 +18,8 @@
*/
package org.elasticsearch.action.admin.cluster.configuration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchTimeoutException;
import org.elasticsearch.action.ActionListener;
@ -48,6 +50,8 @@ import java.util.function.Predicate;
public class TransportClearVotingConfigExclusionsAction
extends TransportMasterNodeAction<ClearVotingConfigExclusionsRequest, ClearVotingConfigExclusionsResponse> {
private static final Logger logger = LogManager.getLogger(TransportClearVotingConfigExclusionsAction.class);
@Inject
public TransportClearVotingConfigExclusionsAction(TransportService transportService, ClusterService clusterService,
ThreadPool threadPool, ActionFilters actionFilters,

View File

@ -19,6 +19,8 @@
package org.elasticsearch.action.admin.cluster.settings;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ActionListener;
@ -46,6 +48,8 @@ import java.io.IOException;
public class TransportClusterUpdateSettingsAction extends
TransportMasterNodeAction<ClusterUpdateSettingsRequest, ClusterUpdateSettingsResponse> {
private static final Logger logger = LogManager.getLogger(TransportClusterUpdateSettingsAction.class);
private final AllocationService allocationService;
private final ClusterSettings clusterSettings;

View File

@ -21,6 +21,8 @@ package org.elasticsearch.action.admin.cluster.snapshots.status;
import com.carrotsearch.hppc.cursors.ObjectCursor;
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRunnable;
import org.elasticsearch.action.StepListener;
@ -61,6 +63,8 @@ import java.util.stream.Collectors;
public class TransportSnapshotsStatusAction extends TransportMasterNodeAction<SnapshotsStatusRequest, SnapshotsStatusResponse> {
private static final Logger logger = LogManager.getLogger(TransportSnapshotsStatusAction.class);
private final SnapshotsService snapshotsService;
private final TransportNodesSnapshotsStatus transportNodesSnapshotsStatus;

View File

@ -19,6 +19,8 @@
package org.elasticsearch.action.admin.cluster.tasks;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.TransportMasterNodeReadAction;
@ -38,6 +40,8 @@ import java.util.List;
public class TransportPendingClusterTasksAction
extends TransportMasterNodeReadAction<PendingClusterTasksRequest, PendingClusterTasksResponse> {
private static final Logger logger = LogManager.getLogger(TransportPendingClusterTasksAction.class);
private final ClusterService clusterService;
@Inject

View File

@ -20,6 +20,8 @@
package org.elasticsearch.action.admin.indices.alias;
import com.carrotsearch.hppc.cursors.ObjectCursor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.RequestValidators;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
@ -60,6 +62,8 @@ import static java.util.Collections.unmodifiableList;
*/
public class TransportIndicesAliasesAction extends TransportMasterNodeAction<IndicesAliasesRequest, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportIndicesAliasesAction.class);
private final MetaDataIndexAliasesService indexAliasesService;
private final RequestValidators<IndicesAliasesRequest> requestValidators;

View File

@ -19,6 +19,8 @@
package org.elasticsearch.action.admin.indices.close;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
@ -49,6 +51,8 @@ import java.util.Collections;
*/
public class TransportCloseIndexAction extends TransportMasterNodeAction<CloseIndexRequest, CloseIndexResponse> {
private static final Logger logger = LogManager.getLogger(TransportCloseIndexAction.class);
private final MetaDataIndexStateService indexStateService;
private final DestructiveOperations destructiveOperations;
private volatile boolean closeIndexEnabled;

View File

@ -19,6 +19,8 @@
package org.elasticsearch.action.admin.indices.delete;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
@ -48,6 +50,8 @@ import java.util.Set;
*/
public class TransportDeleteIndexAction extends TransportMasterNodeAction<DeleteIndexRequest, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportDeleteIndexAction.class);
private final MetaDataDeleteIndexService deleteIndexService;
private final DestructiveOperations destructiveOperations;

View File

@ -19,6 +19,8 @@
package org.elasticsearch.action.admin.indices.mapping.get;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.info.TransportClusterInfoAction;
@ -39,6 +41,8 @@ import java.io.IOException;
public class TransportGetMappingsAction extends TransportClusterInfoAction<GetMappingsRequest, GetMappingsResponse> {
private static final Logger logger = LogManager.getLogger(TransportGetMappingsAction.class);
private final IndicesService indicesService;
@Inject

View File

@ -19,6 +19,8 @@
package org.elasticsearch.action.admin.indices.mapping.put;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.RequestValidators;
@ -48,6 +50,8 @@ import java.util.Optional;
*/
public class TransportPutMappingAction extends TransportMasterNodeAction<PutMappingRequest, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportPutMappingAction.class);
private final MetaDataMappingService metaDataMappingService;
private final RequestValidators<PutMappingRequest> requestValidators;

View File

@ -19,6 +19,8 @@
package org.elasticsearch.action.admin.indices.open;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
@ -45,6 +47,8 @@ import java.io.IOException;
*/
public class TransportOpenIndexAction extends TransportMasterNodeAction<OpenIndexRequest, OpenIndexResponse> {
private static final Logger logger = LogManager.getLogger(TransportOpenIndexAction.class);
private final MetaDataIndexStateService indexStateService;
private final DestructiveOperations destructiveOperations;

View File

@ -19,6 +19,8 @@
package org.elasticsearch.action.admin.indices.settings.put;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
@ -42,6 +44,8 @@ import java.io.IOException;
public class TransportUpdateSettingsAction extends TransportMasterNodeAction<UpdateSettingsRequest, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportUpdateSettingsAction.class);
private final MetaDataUpdateSettingsService updateSettingsService;
@Inject

View File

@ -18,6 +18,7 @@
*/
package org.elasticsearch.action.admin.indices.shards;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.util.CollectionUtil;
import org.elasticsearch.action.ActionListener;
@ -66,6 +67,8 @@ import java.util.concurrent.ConcurrentLinkedQueue;
public class TransportIndicesShardStoresAction
extends TransportMasterNodeReadAction<IndicesShardStoresRequest, IndicesShardStoresResponse> {
private static final Logger logger = LogManager.getLogger(TransportIndicesShardStoresAction.class);
private final TransportNodesListGatewayStartedShards listShardStoresInfo;
@Inject

View File

@ -18,6 +18,8 @@
*/
package org.elasticsearch.action.admin.indices.template.delete;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
@ -42,6 +44,8 @@ import java.io.IOException;
public class TransportDeleteIndexTemplateAction
extends TransportMasterNodeAction<DeleteIndexTemplateRequest, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportDeleteIndexTemplateAction.class);
private final MetaDataIndexTemplateService indexTemplateService;
@Inject

View File

@ -18,6 +18,8 @@
*/
package org.elasticsearch.action.admin.indices.template.put;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
@ -44,6 +46,8 @@ import java.io.IOException;
*/
public class TransportPutIndexTemplateAction extends TransportMasterNodeAction<PutIndexTemplateRequest, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportPutIndexTemplateAction.class);
private final MetaDataIndexTemplateService indexTemplateService;
private final IndexScopedSettings indexScopedSettings;

View File

@ -19,6 +19,8 @@
package org.elasticsearch.action.admin.indices.upgrade.post;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
@ -40,6 +42,8 @@ import java.io.IOException;
public class TransportUpgradeSettingsAction extends TransportMasterNodeAction<UpgradeSettingsRequest, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportUpgradeSettingsAction.class);
private final MetaDataUpdateSettingsService updateSettingsService;
@Inject

View File

@ -58,7 +58,7 @@ import java.util.function.Predicate;
public abstract class TransportMasterNodeAction<Request extends MasterNodeRequest<Request>, Response extends ActionResponse>
extends HandledTransportAction<Request, Response> {
protected static final Logger logger = LogManager.getLogger(TransportMasterNodeAction.class);
private static final Logger logger = LogManager.getLogger(TransportMasterNodeAction.class);
protected final ThreadPool threadPool;
protected final TransportService transportService;

View File

@ -6,6 +6,8 @@
package org.elasticsearch.xpack.ccr.action;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchSecurityException;
@ -48,6 +50,8 @@ import java.util.Objects;
public class TransportUnfollowAction extends TransportMasterNodeAction<UnfollowAction.Request, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportUnfollowAction.class);
private final Client client;
@Inject

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.xpack.frozen.action;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.ResourceNotFoundException;
import org.elasticsearch.action.ActionListener;
@ -47,6 +49,8 @@ import java.util.List;
public final class TransportFreezeIndexAction extends
TransportMasterNodeAction<FreezeRequest, FreezeResponse> {
private static final Logger logger = LogManager.getLogger(TransportFreezeIndexAction.class);
private final DestructiveOperations destructiveOperations;
private final MetaDataIndexStateService indexStateService;

View File

@ -6,6 +6,8 @@
package org.elasticsearch.xpack.ilm.action;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
@ -41,6 +43,8 @@ import java.util.stream.Collectors;
*/
public class TransportPutLifecycleAction extends TransportMasterNodeAction<Request, Response> {
private static final Logger logger = LogManager.getLogger(TransportPutLifecycleAction.class);
@Inject
public TransportPutLifecycleAction(TransportService transportService, ClusterService clusterService, ThreadPool threadPool,
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {

View File

@ -6,6 +6,8 @@
package org.elasticsearch.xpack.ilm.action;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
@ -31,6 +33,8 @@ import java.io.IOException;
public class TransportRetryAction extends TransportMasterNodeAction<Request, Response> {
private static final Logger logger = LogManager.getLogger(TransportRetryAction.class);
IndexLifecycleService indexLifecycleService;
@Inject

View File

@ -6,6 +6,8 @@
package org.elasticsearch.xpack.ml.action;
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.ResourceNotFoundException;
import org.elasticsearch.action.ActionListener;
@ -90,6 +92,8 @@ import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin;
public class TransportDeleteJobAction extends TransportMasterNodeAction<DeleteJobAction.Request, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportDeleteJobAction.class);
private static final int MAX_SNAPSHOTS_TO_DELETE = 10000;
private final Client client;

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.xpack.ml.action;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.WriteRequest;
@ -39,6 +41,8 @@ import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin;
public class TransportFinalizeJobExecutionAction extends TransportMasterNodeAction<FinalizeJobExecutionAction.Request,
AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportFinalizeJobExecutionAction.class);
private final Client client;
@Inject

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.xpack.ml.action;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.TransportMasterNodeReadAction;
@ -36,6 +38,8 @@ import java.util.Set;
public class TransportGetDatafeedsAction extends TransportMasterNodeReadAction<GetDatafeedsAction.Request, GetDatafeedsAction.Response> {
private static final Logger logger = LogManager.getLogger(TransportGetDatafeedsAction.class);
private final DatafeedConfigProvider datafeedConfigProvider;
@Inject

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.xpack.ml.action;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.TransportMasterNodeReadAction;
@ -35,6 +37,8 @@ import java.util.stream.Collectors;
public class TransportGetDatafeedsStatsAction extends TransportMasterNodeReadAction<GetDatafeedsStatsAction.Request,
GetDatafeedsStatsAction.Response> {
private static final Logger logger = LogManager.getLogger(TransportGetDatafeedsStatsAction.class);
private final DatafeedConfigProvider datafeedConfigProvider;
private final JobResultsProvider jobResultsProvider;

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.xpack.ml.action;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.TransportMasterNodeReadAction;
@ -24,6 +26,8 @@ import java.io.IOException;
public class TransportGetJobsAction extends TransportMasterNodeReadAction<GetJobsAction.Request, GetJobsAction.Response> {
private static final Logger logger = LogManager.getLogger(TransportGetJobsAction.class);
private final JobManager jobManager;
@Inject

View File

@ -80,6 +80,8 @@ import static org.elasticsearch.xpack.ml.MachineLearning.MAX_OPEN_JOBS_PER_NODE;
*/
public class TransportOpenJobAction extends TransportMasterNodeAction<OpenJobAction.Request, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportOpenJobAction.class);
static final PersistentTasksCustomMetaData.Assignment AWAITING_MIGRATION =
new PersistentTasksCustomMetaData.Assignment(null, "job cannot be assigned until it has been migrated.");

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.xpack.ml.action;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ResourceNotFoundException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
@ -41,6 +43,8 @@ import java.util.function.Consumer;
public class TransportRevertModelSnapshotAction extends TransportMasterNodeAction<RevertModelSnapshotAction.Request,
RevertModelSnapshotAction.Response> {
private static final Logger logger = LogManager.getLogger(TransportRevertModelSnapshotAction.class);
private final Client client;
private final JobManager jobManager;
private final JobResultsProvider jobResultsProvider;

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.xpack.ml.action;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.ElasticsearchTimeoutException;
@ -53,6 +55,8 @@ import static org.elasticsearch.xpack.core.ml.MlTasks.JOB_TASK_NAME;
public class TransportSetUpgradeModeAction extends TransportMasterNodeAction<SetUpgradeModeAction.Request, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportSetUpgradeModeAction.class);
private final AtomicBoolean isRunning = new AtomicBoolean(false);
private final PersistentTasksClusterService persistentTasksClusterService;
private final PersistentTasksService persistentTasksService;

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.xpack.ml.action;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.ResourceAlreadyExistsException;
@ -78,6 +80,8 @@ import java.util.function.Predicate;
*/
public class TransportStartDatafeedAction extends TransportMasterNodeAction<StartDatafeedAction.Request, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportStartDatafeedAction.class);
private final Client client;
private final XPackLicenseState licenseState;
private final PersistentTasksService persistentTasksService;

View File

@ -61,6 +61,9 @@ import java.util.Objects;
import java.util.stream.Collectors;
public class TransportPutRollupJobAction extends TransportMasterNodeAction<PutRollupJobAction.Request, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportPutRollupJobAction.class);
private final XPackLicenseState licenseState;
private final PersistentTasksService persistentTasksService;
private final Client client;

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.xpack.watcher.transport.actions.service;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
@ -33,6 +35,8 @@ import java.io.IOException;
public class TransportWatcherServiceAction extends TransportMasterNodeAction<WatcherServiceRequest, AcknowledgedResponse> {
private static final Logger logger = LogManager.getLogger(TransportWatcherServiceAction.class);
private AckedRequest ackedRequest = new AckedRequest() {
@Override
public TimeValue ackTimeout() {