Handle removing log4j dependency from elasticsearch-core jar (elastic/x-pack-elasticsearch#3976)

This handles the removal of the log4j dependency from our elasticsearch-core
project. It was originally necessary only for our jar classpath checking. It is
now replaced by a `Consumer<String>`.

This is the x-pack side of https://github.com/elastic/elasticsearch/pull/28705

Original commit: elastic/x-pack-elasticsearch@1186a7eaf6
This commit is contained in:
Lee Hinman 2018-02-20 09:15:56 -07:00 committed by GitHub
parent e365a255c7
commit 6728912c87
37 changed files with 74 additions and 78 deletions

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.core.security;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.Version;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.common.util.concurrent.ThreadContext.StoredContext;
@ -35,7 +35,7 @@ public class SecurityContext {
* and {@link UserSettings#getAuthentication()} will always return null.
*/
public SecurityContext(Settings settings, ThreadContext threadContext) {
this.logger = ServerLoggers.getLogger(getClass(), settings);
this.logger = Loggers.getLogger(getClass(), settings);
this.threadContext = threadContext;
this.userSettings = new UserSettings(settings, threadContext);
this.nodeName = Node.NODE_NAME_SETTING.get(settings);

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.core.security;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.xpack.core.security.authc.Authentication;
@ -19,7 +19,7 @@ public final class UserSettings {
private final ThreadContext threadContext;
UserSettings(Settings settings, ThreadContext threadContext) {
this.logger = ServerLoggers.getLogger(getClass(), settings);
this.logger = Loggers.getLogger(getClass(), settings);
this.threadContext = threadContext;
}

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.core.security.authc;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
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 ServerLoggers.getLogger(clazz, globalSettings);
return Loggers.getLogger(clazz, globalSettings);
}
public Environment env() {

View File

@ -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.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
@ -99,7 +99,7 @@ public class SecurityIndexSearcherWrapper extends IndexSearcherWrapper {
BitsetFilterCache bitsetFilterCache, ThreadContext threadContext, XPackLicenseState licenseState,
ScriptService scriptService) {
this.scriptService = scriptService;
this.logger = ServerLoggers.getLogger(getClass(), indexSettings.getSettings());
this.logger = Loggers.getLogger(getClass(), indexSettings.getSettings());
this.queryShardContextProvider = queryShardContextProvider;
this.bitsetFilterCache = bitsetFilterCache;
this.threadContext = threadContext;

View File

@ -13,7 +13,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.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import javax.net.ssl.SSLEngine;
@ -47,7 +47,7 @@ public final class RestrictedTrustManager extends X509ExtendedTrustManager {
private final int SAN_CODE_OTHERNAME = 0;
public RestrictedTrustManager(Settings settings, X509ExtendedTrustManager delegate, CertificateTrustRestrictions restrictions) {
this.logger = ServerLoggers.getLogger(getClass(), settings);
this.logger = Loggers.getLogger(getClass(), settings);
this.delegate = delegate;
this.trustRestrictions = restrictions;
logger.debug("Configured with trust restrictions: [{}]", restrictions);

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.core.watcher.transform.chain;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.core.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(ServerLoggers.getLogger(ExecutableChainTransform.class, settings));
super(Loggers.getLogger(ExecutableChainTransform.class, settings));
this.registry = registry;
}

View File

@ -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.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
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);
ServerLoggers.setLevel(logger, level);
Loggers.setLevel(logger, level);
final MockAppender appender = new MockAppender(name);
appender.start();
ServerLoggers.addAppender(logger, appender);
Loggers.addAppender(logger, appender);
return logger;
}

View File

@ -7,7 +7,6 @@ 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;
@ -207,15 +206,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);
ServerLoggers.addAppender(cppMessageLogger, mockAppender);
Loggers.addAppender(cppMessageLogger, mockAppender);
Level oldLevel = cppMessageLogger.getLevel();
ServerLoggers.setLevel(cppMessageLogger, level);
Loggers.setLevel(cppMessageLogger, level);
try (CppLogMessageHandler handler = new CppLogMessageHandler(jobId, is)) {
handler.tailStream();
} finally {
ServerLoggers.removeAppender(cppMessageLogger, mockAppender);
ServerLoggers.setLevel(cppMessageLogger, oldLevel);
Loggers.removeAppender(cppMessageLogger, mockAppender);
Loggers.setLevel(cppMessageLogger, oldLevel);
mockAppender.stop();
}

View File

@ -111,7 +111,6 @@ import org.elasticsearch.xpack.core.security.authc.DefaultAuthenticationFailureH
import org.elasticsearch.xpack.core.security.authc.Realm;
import org.elasticsearch.xpack.core.security.authc.RealmSettings;
import org.elasticsearch.xpack.core.security.authc.TokenMetaData;
import org.elasticsearch.xpack.core.security.authc.esnative.NativeRealmSettings;
import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken;
import org.elasticsearch.xpack.core.security.authz.AuthorizationServiceField;
import org.elasticsearch.xpack.core.security.authz.RoleDescriptor;

View File

@ -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.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
@ -44,7 +44,7 @@ final class ExpiredTokenRemover extends AbstractRunnable {
ExpiredTokenRemover(Settings settings, Client client) {
this.client = client;
this.logger = ServerLoggers.getLogger(getClass(), settings);
this.logger = Loggers.getLogger(getClass(), settings);
this.timeout = TokenService.DELETE_TIMEOUT.get(settings);
}

View File

@ -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.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
@ -360,7 +360,7 @@ public class ESNativeRealmMigrateTool extends LoggingAwareMultiCommand {
*/
static Logger getTerminalLogger(final Terminal terminal) {
final Logger logger = ESLoggerFactory.getLogger(ESNativeRealmMigrateTool.class);
ServerLoggers.setLevel(logger, Level.ALL);
Loggers.setLevel(logger, Level.ALL);
// create appender
final Appender appender = new AbstractAppender(ESNativeRealmMigrateTool.class.getName(), null,
@ -387,8 +387,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) -> ServerLoggers.removeAppender(logger, a));
ServerLoggers.addAppender(logger, appender);
loggerConfig.getAppenders().forEach((s, a) -> Loggers.removeAppender(logger, a));
Loggers.addAppender(logger, appender);
return logger;
}
}

View File

@ -31,7 +31,6 @@ import org.elasticsearch.cli.UserException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.LocaleUtils;
import org.elasticsearch.common.util.concurrent.ThreadContext;
@ -90,7 +89,7 @@ public class SamlMetadataCommand extends EnvironmentAwareCommand {
@Override
protected void execute(Terminal terminal, OptionSet options, Environment env) throws Exception {
// OpenSAML prints a lot of _stuff_ at info level, that really isn't needed in a command line tool.
ServerLoggers.setLevel(Loggers.getLogger("org.opensaml"), Level.WARN);
Loggers.setLevel(Loggers.getLogger("org.opensaml"), Level.WARN);
final Logger logger = Loggers.getLogger(getClass());
SamlUtils.initialize(logger);

View File

@ -25,7 +25,7 @@ import org.elasticsearch.ElasticsearchSecurityException;
import org.elasticsearch.common.CheckedFunction;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.xpack.core.security.authc.RealmConfig;
import org.elasticsearch.xpack.security.support.RestorableContextClassLoader;
@ -84,7 +84,7 @@ public class SamlRequestHandler {
private final UnmarshallerFactory unmarshallerFactory;
public SamlRequestHandler(RealmConfig realmConfig, Clock clock, IdpConfiguration idp, SpConfiguration sp, TimeValue maxSkew) {
this.logger = ServerLoggers.getLogger(getClass(), realmConfig.globalSettings());
this.logger = Loggers.getLogger(getClass(), realmConfig.globalSettings());
this.clock = clock;
this.idp = idp;
this.sp = sp;

View File

@ -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.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
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 = ServerLoggers.getLogger(getClass(), settings);
this.logger = Loggers.getLogger(getClass(), settings);
this.auditTrail = auditTrail;
this.licenseState = licenseState;
this.alwaysAllowBoundAddresses = ALLOW_BOUND_ADDRESSES_SETTING.get(settings);

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.actions.email;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.core.watcher.actions.ActionFactory;
@ -25,7 +25,7 @@ public class EmailActionFactory extends ActionFactory {
public EmailActionFactory(Settings settings, EmailService emailService, TextTemplateEngine templateEngine,
EmailAttachmentsParser emailAttachmentsParser) {
super(ServerLoggers.getLogger(ExecutableEmailAction.class, settings));
super(Loggers.getLogger(ExecutableEmailAction.class, settings));
this.emailService = emailService;
this.templateEngine = templateEngine;
this.htmlSanitizer = new HtmlSanitizer(settings);

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.actions.hipchat;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.core.watcher.actions.ActionFactory;
@ -21,7 +21,7 @@ public class HipChatActionFactory extends ActionFactory {
private final HipChatService hipchatService;
public HipChatActionFactory(Settings settings, TextTemplateEngine templateEngine, HipChatService hipchatService) {
super(ServerLoggers.getLogger(ExecutableHipChatAction.class, settings));
super(Loggers.getLogger(ExecutableHipChatAction.class, settings));
this.templateEngine = templateEngine;
this.hipchatService = hipchatService;
}

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.watcher.actions.index;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
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(ServerLoggers.getLogger(IndexActionFactory.class, settings));
super(Loggers.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));

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.actions.jira;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.core.watcher.actions.ActionFactory;
@ -20,7 +20,7 @@ public class JiraActionFactory extends ActionFactory {
private final JiraService jiraService;
public JiraActionFactory(Settings settings, TextTemplateEngine templateEngine, JiraService jiraService) {
super(ServerLoggers.getLogger(ExecutableJiraAction.class, settings));
super(Loggers.getLogger(ExecutableJiraAction.class, settings));
this.templateEngine = templateEngine;
this.jiraService = jiraService;
}

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.watcher.actions.logging;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.core.watcher.actions.Action;
import org.elasticsearch.xpack.core.watcher.actions.ExecutableAction;
@ -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 ? ServerLoggers.getLogger(action.category, settings) : logger;
this.textLogger = action.category != null ? Loggers.getLogger(action.category, settings) : logger;
this.templateEngine = templateEngine;
}

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.actions.logging;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.core.watcher.actions.ActionFactory;
@ -19,7 +19,7 @@ public class LoggingActionFactory extends ActionFactory {
private final TextTemplateEngine templateEngine;
public LoggingActionFactory(Settings settings, TextTemplateEngine templateEngine) {
super(ServerLoggers.getLogger(ExecutableLoggingAction.class, settings));
super(Loggers.getLogger(ExecutableLoggingAction.class, settings));
this.settings = settings;
this.templateEngine = templateEngine;
}

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.actions.pagerduty;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.core.watcher.actions.ActionFactory;
@ -20,7 +20,7 @@ public class PagerDutyActionFactory extends ActionFactory {
private final PagerDutyService pagerDutyService;
public PagerDutyActionFactory(Settings settings, TextTemplateEngine templateEngine, PagerDutyService pagerDutyService) {
super(ServerLoggers.getLogger(ExecutablePagerDutyAction.class, settings));
super(Loggers.getLogger(ExecutablePagerDutyAction.class, settings));
this.templateEngine = templateEngine;
this.pagerDutyService = pagerDutyService;
}

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.actions.slack;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.core.watcher.actions.ActionFactory;
@ -19,7 +19,7 @@ public class SlackActionFactory extends ActionFactory {
private final SlackService slackService;
public SlackActionFactory(Settings settings, TextTemplateEngine templateEngine, SlackService slackService) {
super(ServerLoggers.getLogger(ExecutableSlackAction.class, settings));
super(Loggers.getLogger(ExecutableSlackAction.class, settings));
this.templateEngine = templateEngine;
this.slackService = slackService;
}

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.actions.webhook;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.core.watcher.actions.ActionFactory;
@ -24,7 +24,7 @@ public class WebhookActionFactory extends ActionFactory {
public WebhookActionFactory(Settings settings, HttpClient httpClient, HttpRequestTemplate.Parser requestTemplateParser,
TextTemplateEngine templateEngine) {
super(ServerLoggers.getLogger(ExecutableWebhookAction.class, settings));
super(Loggers.getLogger(ExecutableWebhookAction.class, settings));
this.httpClient = httpClient;
this.requestTemplateParser = requestTemplateParser;
this.templateEngine = templateEngine;

View File

@ -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.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.core.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 = ServerLoggers.getLogger(SyncTriggerEventConsumer.class, settings);
this.logger = Loggers.getLogger(SyncTriggerEventConsumer.class, settings);
this.executionService = executionService;
}

View File

@ -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.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.core.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 = ServerLoggers.getLogger(SyncTriggerEventConsumer.class, settings);
this.logger = Loggers.getLogger(SyncTriggerEventConsumer.class, settings);
this.executionService = executionService;
}

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.watcher.input.chain;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.core.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(ServerLoggers.getLogger(ExecutableChainInput.class, settings));
super(Loggers.getLogger(ExecutableChainInput.class, settings));
this.inputRegistry = inputRegistry;
}

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.input.http;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
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(ServerLoggers.getLogger(ExecutableHttpInput.class, settings));
super(Loggers.getLogger(ExecutableHttpInput.class, settings));
this.templateEngine = templateEngine;
this.httpClient = httpClient;
this.requestTemplateParser = requestTemplateParser;

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.input.none;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.core.watcher.input.none.NoneInput;
@ -16,7 +16,7 @@ import java.io.IOException;
public class NoneInputFactory extends InputFactory<NoneInput, NoneInput.Result, ExecutableNoneInput> {
public NoneInputFactory(Settings settings) {
super(ServerLoggers.getLogger(ExecutableNoneInput.class, settings));
super(Loggers.getLogger(ExecutableNoneInput.class, settings));
}
@Override

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.watcher.input.search;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
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(ServerLoggers.getLogger(ExecutableSearchInput.class, settings));
super(Loggers.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);

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.input.simple;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
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(ServerLoggers.getLogger(ExecutableSimpleInput.class, settings));
super(Loggers.getLogger(ExecutableSimpleInput.class, settings));
}
@Override

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.input.transform;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
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(ServerLoggers.getLogger(ExecutableTransformInput.class, settings));
super(Loggers.getLogger(ExecutableTransformInput.class, settings));
this.transformRegistry = transformRegistry;
}

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.transform.script;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
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(ServerLoggers.getLogger(ExecutableScriptTransform.class, settings));
super(Loggers.getLogger(ExecutableScriptTransform.class, settings));
this.scriptService = scriptService;
}

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.watcher.transform.search;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
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(ServerLoggers.getLogger(ExecutableSearchTransform.class, settings));
super(Loggers.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);

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.watcher.test;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.threadpool.ThreadPool;
@ -36,7 +36,7 @@ public class TimeWarpedWatcher extends LocalStateCompositeXPackPlugin {
public TimeWarpedWatcher(final Settings settings, final Path configPath) throws Exception {
super(settings, configPath);
Logger logger = ServerLoggers.getLogger(TimeWarpedWatcher.class, settings);
Logger logger = Loggers.getLogger(TimeWarpedWatcher.class, settings);
logger.info("using time warped watchers plugin");
TimeWarpedWatcher thisVar = this;

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.watcher.test.bench;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.node.MockNode;
@ -207,7 +207,7 @@ public class WatcherExecutorServiceBenchmark {
public BenchmarkWatcher(Settings settings) {
super(settings);
ServerLoggers.getLogger(BenchmarkWatcher.class, settings).info("using watcher benchmark plugin");
Loggers.getLogger(BenchmarkWatcher.class, settings).info("using watcher benchmark plugin");
}
@Override

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.watcher.trigger;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.ServerLoggers;
import org.elasticsearch.common.logging.Loggers;
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 = ServerLoggers.getLogger(ScheduleTriggerEngineMock.class, settings);
this.logger = Loggers.getLogger(ScheduleTriggerEngineMock.class, settings);
}
@Override

View File

@ -24,7 +24,6 @@ import java.nio.charset.StandardCharsets;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.function.Predicate;