mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Modify x-pack to support elasticsearch-core jar (elastic/x-pack-elasticsearch#3544)
This is related to elastic/elasticsearch#27933. It modifies x-pack to be compatible with the new elasticsearch-core jar. Original commit: elastic/x-pack-elasticsearch@42227b6034
This commit is contained in:
parent
e44a09f5df
commit
5eef187b19
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.transform.chain;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.transform.ExecutableTransform;
|
||||
@ -21,7 +21,7 @@ public final class ChainTransformFactory extends TransformFactory<ChainTransform
|
||||
private final TransformRegistry registry;
|
||||
|
||||
public ChainTransformFactory(Settings settings, TransformRegistry registry) {
|
||||
super(Loggers.getLogger(ExecutableChainTransform.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableChainTransform.class, settings));
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@ import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
||||
import org.elasticsearch.common.util.concurrent.FutureUtils;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.xpack.ml.action.DeleteExpiredDataAction;
|
||||
import org.joda.time.DateTime;
|
||||
@ -27,7 +26,6 @@ import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.xpack.ClientHelper.ML_ORIGIN;
|
||||
import static org.elasticsearch.xpack.ClientHelper.executeAsyncWithOrigin;
|
||||
import static org.elasticsearch.xpack.ClientHelper.stashWithOrigin;
|
||||
|
||||
/**
|
||||
* A service that runs once a day and triggers maintenance tasks.
|
||||
|
@ -29,7 +29,6 @@ import org.elasticsearch.xpack.ml.job.results.Bucket;
|
||||
import org.elasticsearch.xpack.ml.job.results.CategoryDefinition;
|
||||
import org.elasticsearch.xpack.ml.job.results.Forecast;
|
||||
import org.elasticsearch.xpack.ml.job.results.ForecastRequestStats;
|
||||
import org.elasticsearch.xpack.ml.job.results.ForecastRequestStats.ForecastRequestStatus;
|
||||
import org.elasticsearch.xpack.ml.job.results.Influencer;
|
||||
import org.elasticsearch.xpack.ml.job.results.ModelPlot;
|
||||
|
||||
|
@ -7,7 +7,7 @@ package org.elasticsearch.xpack.security;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext.StoredContext;
|
||||
@ -34,7 +34,7 @@ public class SecurityContext {
|
||||
* and {@link #getAuthentication()} will always return null.
|
||||
*/
|
||||
public SecurityContext(Settings settings, ThreadContext threadContext) {
|
||||
this.logger = Loggers.getLogger(getClass(), settings);
|
||||
this.logger = ServerLoggers.getLogger(getClass(), settings);
|
||||
this.threadContext = threadContext;
|
||||
this.nodeName = Node.NODE_NAME_SETTING.get(settings);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.bulk.BulkItemResponse;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
|
||||
@ -43,7 +43,7 @@ final class ExpiredTokenRemover extends AbstractRunnable {
|
||||
|
||||
ExpiredTokenRemover(Settings settings, Client client) {
|
||||
this.client = client;
|
||||
this.logger = Loggers.getLogger(getClass(), settings);
|
||||
this.logger = ServerLoggers.getLogger(getClass(), settings);
|
||||
this.timeout = TokenService.DELETE_TIMEOUT.get(settings);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.security.authc;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.env.Environment;
|
||||
@ -60,7 +60,7 @@ public class RealmConfig {
|
||||
}
|
||||
|
||||
public Logger logger(Class clazz) {
|
||||
return Loggers.getLogger(clazz, globalSettings);
|
||||
return ServerLoggers.getLogger(clazz, globalSettings);
|
||||
}
|
||||
|
||||
public Environment env() {
|
||||
|
@ -27,7 +27,7 @@ import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.logging.ESLoggerFactory;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.SecureString;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
@ -357,7 +357,7 @@ public class ESNativeRealmMigrateTool extends LoggingAwareMultiCommand {
|
||||
*/
|
||||
static Logger getTerminalLogger(final Terminal terminal) {
|
||||
final Logger logger = ESLoggerFactory.getLogger(ESNativeRealmMigrateTool.class);
|
||||
Loggers.setLevel(logger, Level.ALL);
|
||||
ServerLoggers.setLevel(logger, Level.ALL);
|
||||
|
||||
// create appender
|
||||
final Appender appender = new AbstractAppender(ESNativeRealmMigrateTool.class.getName(), null,
|
||||
@ -384,8 +384,8 @@ public class ESNativeRealmMigrateTool extends LoggingAwareMultiCommand {
|
||||
final Configuration config = ctx.getConfiguration();
|
||||
final LoggerConfig loggerConfig = config.getLoggerConfig(ESNativeRealmMigrateTool.class.getName());
|
||||
loggerConfig.setParent(null);
|
||||
loggerConfig.getAppenders().forEach((s, a) -> Loggers.removeAppender(logger, a));
|
||||
Loggers.addAppender(logger, appender);
|
||||
loggerConfig.getAppenders().forEach((s, a) -> ServerLoggers.removeAppender(logger, a));
|
||||
ServerLoggers.addAppender(logger, appender);
|
||||
return logger;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import org.elasticsearch.ElasticsearchParseException;
|
||||
import org.elasticsearch.ExceptionsHelper;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.lucene.search.Queries;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
@ -98,7 +98,7 @@ public class SecurityIndexSearcherWrapper extends IndexSearcherWrapper {
|
||||
BitsetFilterCache bitsetFilterCache, ThreadContext threadContext, XPackLicenseState licenseState,
|
||||
ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
this.logger = Loggers.getLogger(getClass(), indexSettings.getSettings());
|
||||
this.logger = ServerLoggers.getLogger(getClass(), indexSettings.getSettings());
|
||||
this.queryShardContextProvider = queryShardContextProvider;
|
||||
this.bitsetFilterCache = bitsetFilterCache;
|
||||
this.threadContext = threadContext;
|
||||
|
@ -10,7 +10,7 @@ import io.netty.handler.ipfilter.IpFilterRuleType;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.lucene.util.SetOnce;
|
||||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Property;
|
||||
@ -117,7 +117,7 @@ public class IPFilter {
|
||||
|
||||
public IPFilter(final Settings settings, AuditTrailService auditTrail, ClusterSettings clusterSettings,
|
||||
XPackLicenseState licenseState) {
|
||||
this.logger = Loggers.getLogger(getClass(), settings);
|
||||
this.logger = ServerLoggers.getLogger(getClass(), settings);
|
||||
this.auditTrail = auditTrail;
|
||||
this.licenseState = licenseState;
|
||||
this.alwaysAllowBoundAddresses = ALLOW_BOUND_ADDRESSES_SETTING.get(settings);
|
||||
|
@ -28,7 +28,7 @@ import org.bouncycastle.asn1.ASN1Sequence;
|
||||
import org.bouncycastle.asn1.ASN1String;
|
||||
import org.bouncycastle.asn1.ASN1TaggedObject;
|
||||
import org.bouncycastle.asn1.DERTaggedObject;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
@ -46,7 +46,7 @@ public final class RestrictedTrustManager extends X509ExtendedTrustManager {
|
||||
private final int SAN_CODE_OTHERNAME = 0;
|
||||
|
||||
public RestrictedTrustManager(Settings settings, X509ExtendedTrustManager delegate, CertificateTrustRestrictions restrictions) {
|
||||
this.logger = Loggers.getLogger(getClass(), settings);
|
||||
this.logger = ServerLoggers.getLogger(getClass(), settings);
|
||||
this.delegate = delegate;
|
||||
this.trustRestrictions = restrictions;
|
||||
logger.debug("Configured with trust restrictions: [{}]", restrictions);
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.actions.email;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine;
|
||||
@ -25,7 +25,7 @@ public class EmailActionFactory extends ActionFactory {
|
||||
|
||||
public EmailActionFactory(Settings settings, EmailService emailService, TextTemplateEngine templateEngine,
|
||||
EmailAttachmentsParser emailAttachmentsParser) {
|
||||
super(Loggers.getLogger(ExecutableEmailAction.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableEmailAction.class, settings));
|
||||
this.emailService = emailService;
|
||||
this.templateEngine = templateEngine;
|
||||
this.htmlSanitizer = new HtmlSanitizer(settings);
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.actions.hipchat;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine;
|
||||
@ -21,7 +21,7 @@ public class HipChatActionFactory extends ActionFactory {
|
||||
private final HipChatService hipchatService;
|
||||
|
||||
public HipChatActionFactory(Settings settings, TextTemplateEngine templateEngine, HipChatService hipchatService) {
|
||||
super(Loggers.getLogger(ExecutableHipChatAction.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableHipChatAction.class, settings));
|
||||
this.templateEngine = templateEngine;
|
||||
this.hipchatService = hipchatService;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.watcher.actions.index;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
@ -21,7 +21,7 @@ public class IndexActionFactory extends ActionFactory {
|
||||
private final TimeValue bulkDefaultTimeout;
|
||||
|
||||
public IndexActionFactory(Settings settings, Client client) {
|
||||
super(Loggers.getLogger(IndexActionFactory.class, settings));
|
||||
super(ServerLoggers.getLogger(IndexActionFactory.class, settings));
|
||||
this.client = client;
|
||||
this.indexDefaultTimeout = settings.getAsTime("xpack.watcher.actions.index.default_timeout", TimeValue.timeValueSeconds(30));
|
||||
this.bulkDefaultTimeout = settings.getAsTime("xpack.watcher.actions.bulk.default_timeout", TimeValue.timeValueMinutes(1));
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.actions.jira;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine;
|
||||
@ -20,7 +20,7 @@ public class JiraActionFactory extends ActionFactory {
|
||||
private final JiraService jiraService;
|
||||
|
||||
public JiraActionFactory(Settings settings, TextTemplateEngine templateEngine, JiraService jiraService) {
|
||||
super(Loggers.getLogger(ExecutableJiraAction.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableJiraAction.class, settings));
|
||||
this.templateEngine = templateEngine;
|
||||
this.jiraService = jiraService;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.watcher.actions.logging;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine;
|
||||
import org.elasticsearch.xpack.watcher.actions.Action;
|
||||
@ -24,7 +24,7 @@ public class ExecutableLoggingAction extends ExecutableAction<LoggingAction> {
|
||||
|
||||
public ExecutableLoggingAction(LoggingAction action, Logger logger, Settings settings, TextTemplateEngine templateEngine) {
|
||||
super(action, logger);
|
||||
this.textLogger = action.category != null ? Loggers.getLogger(action.category, settings) : logger;
|
||||
this.textLogger = action.category != null ? ServerLoggers.getLogger(action.category, settings) : logger;
|
||||
this.templateEngine = templateEngine;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.actions.logging;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine;
|
||||
@ -19,7 +19,7 @@ public class LoggingActionFactory extends ActionFactory {
|
||||
private final TextTemplateEngine templateEngine;
|
||||
|
||||
public LoggingActionFactory(Settings settings, TextTemplateEngine templateEngine) {
|
||||
super(Loggers.getLogger(ExecutableLoggingAction.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableLoggingAction.class, settings));
|
||||
this.settings = settings;
|
||||
this.templateEngine = templateEngine;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.actions.pagerduty;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine;
|
||||
@ -20,7 +20,7 @@ public class PagerDutyActionFactory extends ActionFactory {
|
||||
private final PagerDutyService pagerDutyService;
|
||||
|
||||
public PagerDutyActionFactory(Settings settings, TextTemplateEngine templateEngine, PagerDutyService pagerDutyService) {
|
||||
super(Loggers.getLogger(ExecutablePagerDutyAction.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutablePagerDutyAction.class, settings));
|
||||
this.templateEngine = templateEngine;
|
||||
this.pagerDutyService = pagerDutyService;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.actions.slack;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine;
|
||||
@ -19,7 +19,7 @@ public class SlackActionFactory extends ActionFactory {
|
||||
private final SlackService slackService;
|
||||
|
||||
public SlackActionFactory(Settings settings, TextTemplateEngine templateEngine, SlackService slackService) {
|
||||
super(Loggers.getLogger(ExecutableSlackAction.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableSlackAction.class, settings));
|
||||
this.templateEngine = templateEngine;
|
||||
this.slackService = slackService;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.actions.webhook;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine;
|
||||
@ -24,7 +24,7 @@ public class WebhookActionFactory extends ActionFactory {
|
||||
public WebhookActionFactory(Settings settings, HttpClient httpClient, HttpRequestTemplate.Parser requestTemplateParser,
|
||||
TextTemplateEngine templateEngine) {
|
||||
|
||||
super(Loggers.getLogger(ExecutableWebhookAction.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableWebhookAction.class, settings));
|
||||
this.httpClient = httpClient;
|
||||
this.requestTemplateParser = requestTemplateParser;
|
||||
this.templateEngine = templateEngine;
|
||||
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.execution;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.apache.logging.log4j.util.Supplier;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
|
||||
|
||||
@ -22,7 +22,7 @@ public class AsyncTriggerEventConsumer implements Consumer<Iterable<TriggerEvent
|
||||
private final ExecutionService executionService;
|
||||
|
||||
public AsyncTriggerEventConsumer(Settings settings, ExecutionService executionService) {
|
||||
this.logger = Loggers.getLogger(SyncTriggerEventConsumer.class, settings);
|
||||
this.logger = ServerLoggers.getLogger(SyncTriggerEventConsumer.class, settings);
|
||||
this.executionService = executionService;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.execution;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.apache.logging.log4j.util.Supplier;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
|
||||
|
||||
@ -22,7 +22,7 @@ public class SyncTriggerEventConsumer implements Consumer<Iterable<TriggerEvent>
|
||||
private final Logger logger;
|
||||
|
||||
public SyncTriggerEventConsumer(Settings settings, ExecutionService executionService) {
|
||||
this.logger = Loggers.getLogger(SyncTriggerEventConsumer.class, settings);
|
||||
this.logger = ServerLoggers.getLogger(SyncTriggerEventConsumer.class, settings);
|
||||
this.executionService = executionService;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.watcher.input.chain;
|
||||
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.input.ExecutableInput;
|
||||
@ -23,7 +23,7 @@ public class ChainInputFactory extends InputFactory<ChainInput, ChainInput.Resul
|
||||
private final InputRegistry inputRegistry;
|
||||
|
||||
public ChainInputFactory(Settings settings, InputRegistry inputRegistry) {
|
||||
super(Loggers.getLogger(ExecutableChainInput.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableChainInput.class, settings));
|
||||
this.inputRegistry = inputRegistry;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.input.http;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.common.http.HttpClient;
|
||||
@ -23,7 +23,7 @@ public final class HttpInputFactory extends InputFactory<HttpInput, HttpInput.Re
|
||||
|
||||
public HttpInputFactory(Settings settings, HttpClient httpClient, TextTemplateEngine templateEngine,
|
||||
HttpRequestTemplate.Parser requestTemplateParser) {
|
||||
super(Loggers.getLogger(ExecutableHttpInput.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableHttpInput.class, settings));
|
||||
this.templateEngine = templateEngine;
|
||||
this.httpClient = httpClient;
|
||||
this.requestTemplateParser = requestTemplateParser;
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.input.none;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.input.InputFactory;
|
||||
@ -15,7 +15,7 @@ import java.io.IOException;
|
||||
public class NoneInputFactory extends InputFactory<NoneInput, NoneInput.Result, ExecutableNoneInput> {
|
||||
|
||||
public NoneInputFactory(Settings settings) {
|
||||
super(Loggers.getLogger(ExecutableNoneInput.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableNoneInput.class, settings));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.watcher.input.search;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
@ -25,7 +25,7 @@ public class SearchInputFactory extends InputFactory<SearchInput, SearchInput.Re
|
||||
|
||||
public SearchInputFactory(Settings settings, Client client, NamedXContentRegistry xContentRegistry,
|
||||
ScriptService scriptService) {
|
||||
super(Loggers.getLogger(ExecutableSearchInput.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableSearchInput.class, settings));
|
||||
this.client = client;
|
||||
this.defaultTimeout = settings.getAsTime("xpack.watcher.input.search.default_timeout", TimeValue.timeValueMinutes(1));
|
||||
this.searchTemplateService = new WatcherSearchTemplateService(settings, scriptService, xContentRegistry);
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.input.simple;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.input.InputFactory;
|
||||
@ -15,7 +15,7 @@ import java.io.IOException;
|
||||
public class SimpleInputFactory extends InputFactory<SimpleInput, SimpleInput.Result, ExecutableSimpleInput> {
|
||||
|
||||
public SimpleInputFactory(Settings settings) {
|
||||
super(Loggers.getLogger(ExecutableSimpleInput.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableSimpleInput.class, settings));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.input.transform;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.XContentParserUtils;
|
||||
@ -32,7 +32,7 @@ public final class TransformInputFactory extends InputFactory<TransformInput, Tr
|
||||
private final TransformRegistry transformRegistry;
|
||||
|
||||
public TransformInputFactory(Settings settings, TransformRegistry transformRegistry) {
|
||||
super(Loggers.getLogger(ExecutableTransformInput.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableTransformInput.class, settings));
|
||||
this.transformRegistry = transformRegistry;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.transform.script;
|
||||
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
@ -18,7 +18,7 @@ public class ScriptTransformFactory extends TransformFactory<ScriptTransform, Sc
|
||||
private final ScriptService scriptService;
|
||||
|
||||
public ScriptTransformFactory(Settings settings, ScriptService scriptService) {
|
||||
super(Loggers.getLogger(ExecutableScriptTransform.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableScriptTransform.class, settings));
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.watcher.transform.search;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
@ -24,7 +24,7 @@ public class SearchTransformFactory extends TransformFactory<SearchTransform, Se
|
||||
private final WatcherSearchTemplateService searchTemplateService;
|
||||
|
||||
public SearchTransformFactory(Settings settings, Client client, NamedXContentRegistry xContentRegistry, ScriptService scriptService) {
|
||||
super(Loggers.getLogger(ExecutableSearchTransform.class, settings));
|
||||
super(ServerLoggers.getLogger(ExecutableSearchTransform.class, settings));
|
||||
this.client = client;
|
||||
this.defaultTimeout = settings.getAsTime("xpack.watcher.transform.search.default_timeout", TimeValue.timeValueMinutes(1));
|
||||
this.searchTemplateService = new WatcherSearchTemplateService(settings, scriptService, xContentRegistry);
|
||||
|
@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.job.process.logging;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.test.MockLogAppender;
|
||||
@ -206,15 +207,15 @@ public class CppLogMessageHandlerTests extends ESTestCase {
|
||||
private static void executeLoggingTest(InputStream is, MockLogAppender mockAppender, Level level, String jobId)
|
||||
throws IOException {
|
||||
Logger cppMessageLogger = Loggers.getLogger(CppLogMessageHandler.class);
|
||||
Loggers.addAppender(cppMessageLogger, mockAppender);
|
||||
ServerLoggers.addAppender(cppMessageLogger, mockAppender);
|
||||
|
||||
Level oldLevel = cppMessageLogger.getLevel();
|
||||
Loggers.setLevel(cppMessageLogger, level);
|
||||
ServerLoggers.setLevel(cppMessageLogger, level);
|
||||
try (CppLogMessageHandler handler = new CppLogMessageHandler(jobId, is)) {
|
||||
handler.tailStream();
|
||||
} finally {
|
||||
Loggers.removeAppender(cppMessageLogger, mockAppender);
|
||||
Loggers.setLevel(cppMessageLogger, oldLevel);
|
||||
ServerLoggers.removeAppender(cppMessageLogger, mockAppender);
|
||||
ServerLoggers.setLevel(cppMessageLogger, oldLevel);
|
||||
mockAppender.stop();
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ import org.apache.logging.log4j.core.config.Configuration;
|
||||
import org.apache.logging.log4j.core.config.LoggerConfig;
|
||||
import org.apache.logging.log4j.core.filter.RegexFilter;
|
||||
import org.elasticsearch.common.logging.ESLoggerFactory;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -26,10 +26,10 @@ public class CapturingLogger {
|
||||
final StackTraceElement caller = Thread.currentThread().getStackTrace()[2];
|
||||
final String name = caller.getClassName() + "." + caller.getMethodName() + "." + level.toString();
|
||||
final Logger logger = ESLoggerFactory.getLogger(name);
|
||||
Loggers.setLevel(logger, level);
|
||||
ServerLoggers.setLevel(logger, level);
|
||||
final MockAppender appender = new MockAppender(name);
|
||||
appender.start();
|
||||
Loggers.addAppender(logger, appender);
|
||||
ServerLoggers.addAppender(logger, appender);
|
||||
return logger;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.watcher.test;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.xpack.watcher.Watcher;
|
||||
@ -28,7 +28,7 @@ public class TimeWarpedWatcher extends Watcher {
|
||||
|
||||
public TimeWarpedWatcher(Settings settings) {
|
||||
super(settings);
|
||||
Logger logger = Loggers.getLogger(TimeWarpedWatcher.class, settings);
|
||||
Logger logger = ServerLoggers.getLogger(TimeWarpedWatcher.class, settings);
|
||||
logger.info("using time warped watchers plugin");
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ package org.elasticsearch.xpack.watcher.test.bench;
|
||||
|
||||
import org.bouncycastle.operator.OperatorCreationException;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.node.MockNode;
|
||||
@ -226,7 +226,7 @@ public class WatcherExecutorServiceBenchmark {
|
||||
|
||||
public BenchmarkWatcher(Settings settings) {
|
||||
super(settings);
|
||||
Loggers.getLogger(XPackBenchmarkPlugin.class, settings).info("using watcher benchmark plugin");
|
||||
ServerLoggers.getLogger(XPackBenchmarkPlugin.class, settings).info("using watcher benchmark plugin");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.watcher.trigger;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.logging.ServerLoggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
@ -36,7 +36,7 @@ public class ScheduleTriggerEngineMock extends ScheduleTriggerEngine {
|
||||
|
||||
public ScheduleTriggerEngineMock(Settings settings, ScheduleRegistry scheduleRegistry, Clock clock) {
|
||||
super(settings, scheduleRegistry, clock);
|
||||
this.logger = Loggers.getLogger(ScheduleTriggerEngineMock.class, settings);
|
||||
this.logger = ServerLoggers.getLogger(ScheduleTriggerEngineMock.class, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user