Handle core's log refactoring
Original commit: elastic/x-pack-elasticsearch@9e2e41db90
This commit is contained in:
parent
06fc60c2f6
commit
d7170197f6
|
@ -24,7 +24,7 @@ import org.elasticsearch.common.inject.Singleton;
|
||||||
import org.elasticsearch.common.io.Streams;
|
import org.elasticsearch.common.io.Streams;
|
||||||
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
|
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
|
||||||
import org.elasticsearch.common.joda.Joda;
|
import org.elasticsearch.common.joda.Joda;
|
||||||
import org.elasticsearch.common.logging.support.LoggerMessageFormat;
|
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
||||||
|
|
|
@ -7,7 +7,7 @@ package org.elasticsearch.marvel.license;
|
||||||
|
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.logging.support.LoggerMessageFormat;
|
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.license.core.License;
|
import org.elasticsearch.license.core.License;
|
||||||
import org.elasticsearch.license.plugin.core.AbstractLicenseeComponent;
|
import org.elasticsearch.license.plugin.core.AbstractLicenseeComponent;
|
||||||
|
|
|
@ -8,13 +8,12 @@ package org.elasticsearch.shield.action.interceptor;
|
||||||
import org.elasticsearch.action.CompositeIndicesRequest;
|
import org.elasticsearch.action.CompositeIndicesRequest;
|
||||||
import org.elasticsearch.action.IndicesRequest;
|
import org.elasticsearch.action.IndicesRequest;
|
||||||
import org.elasticsearch.common.component.AbstractComponent;
|
import org.elasticsearch.common.component.AbstractComponent;
|
||||||
import org.elasticsearch.common.logging.support.LoggerMessageFormat;
|
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||||
import org.elasticsearch.shield.User;
|
import org.elasticsearch.shield.User;
|
||||||
import org.elasticsearch.shield.authz.InternalAuthorizationService;
|
import org.elasticsearch.shield.authz.InternalAuthorizationService;
|
||||||
import org.elasticsearch.shield.authz.accesscontrol.IndicesAccessControl;
|
import org.elasticsearch.shield.authz.accesscontrol.IndicesAccessControl;
|
||||||
import org.elasticsearch.transport.TransportRequest;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.apache.lucene.util.BitSet;
|
||||||
import org.apache.lucene.util.BitSetIterator;
|
import org.apache.lucene.util.BitSetIterator;
|
||||||
import org.apache.lucene.util.Bits;
|
import org.apache.lucene.util.Bits;
|
||||||
import org.elasticsearch.ExceptionsHelper;
|
import org.elasticsearch.ExceptionsHelper;
|
||||||
import org.elasticsearch.common.logging.support.LoggerMessageFormat;
|
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||||
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.lucene.util.FilterIterator;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.collect.Tuple;
|
import org.elasticsearch.common.collect.Tuple;
|
||||||
import org.elasticsearch.common.logging.support.LoggerMessageFormat;
|
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
|
|
|
@ -24,8 +24,8 @@ import org.apache.lucene.util.SparseFixedBitSet;
|
||||||
import org.elasticsearch.ExceptionsHelper;
|
import org.elasticsearch.ExceptionsHelper;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.logging.ESLogger;
|
import org.elasticsearch.common.logging.ESLogger;
|
||||||
|
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
import org.elasticsearch.common.logging.support.LoggerMessageFormat;
|
|
||||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||||
import org.elasticsearch.index.IndexSettings;
|
import org.elasticsearch.index.IndexSettings;
|
||||||
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||||
|
|
|
@ -8,13 +8,14 @@ package org.elasticsearch.shield.support;
|
||||||
import org.elasticsearch.common.logging.ESLogger;
|
import org.elasticsearch.common.logging.ESLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* A logger that doesn't log anything.
|
||||||
*/
|
*/
|
||||||
public class NoOpLogger implements ESLogger {
|
public class NoOpLogger extends ESLogger {
|
||||||
|
|
||||||
public static final ESLogger INSTANCE = new NoOpLogger();
|
public static final ESLogger INSTANCE = new NoOpLogger();
|
||||||
|
|
||||||
private NoOpLogger() {
|
private NoOpLogger() {
|
||||||
|
super(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,16 +5,18 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.shield.audit.logfile;
|
package org.elasticsearch.shield.audit.logfile;
|
||||||
|
|
||||||
import org.elasticsearch.common.logging.support.AbstractESLogger;
|
import org.elasticsearch.common.logging.ESLogger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static org.elasticsearch.common.logging.LoggerMessageFormat.format;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CapturingLogger extends AbstractESLogger {
|
public class CapturingLogger extends ESLogger {
|
||||||
|
|
||||||
private Level level;
|
private Level level;
|
||||||
|
|
||||||
|
@ -25,58 +27,43 @@ public class CapturingLogger extends AbstractESLogger {
|
||||||
public final List<Msg> trace = new ArrayList<>();
|
public final List<Msg> trace = new ArrayList<>();
|
||||||
|
|
||||||
public CapturingLogger(Level level) {
|
public CapturingLogger(Level level) {
|
||||||
super("");
|
super(null, null);
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void internalTrace(String msg) {
|
public void trace(String msg, Throwable cause, Object... params) {
|
||||||
add(trace, msg);
|
if (isTraceEnabled()) {
|
||||||
|
add(trace, format(msg, params), cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void internalTrace(String msg, Throwable cause) {
|
public void debug(String msg, Throwable cause, Object... params) {
|
||||||
add(trace, msg, cause);
|
if (isDebugEnabled()) {
|
||||||
|
add(debug, format(msg, params), cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void internalDebug(String msg) {
|
public void info(String msg, Throwable cause, Object... params) {
|
||||||
add(debug, msg);
|
if (isInfoEnabled()) {
|
||||||
|
add(info, format(msg, params), cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void internalDebug(String msg, Throwable cause) {
|
public void warn(String msg, Throwable cause, Object... params) {
|
||||||
add(debug, msg, cause);
|
if (isWarnEnabled()) {
|
||||||
|
add(warn, format(msg, params), cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void internalInfo(String msg) {
|
public void error(String msg, Throwable cause, Object... params) {
|
||||||
add(info, msg);
|
if (isErrorEnabled()) {
|
||||||
}
|
add(error, format(msg, params), cause);
|
||||||
|
}
|
||||||
@Override
|
|
||||||
protected void internalInfo(String msg, Throwable cause) {
|
|
||||||
add(info, msg, cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void internalWarn(String msg) {
|
|
||||||
add(warn, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void internalWarn(String msg, Throwable cause) {
|
|
||||||
add(warn, msg, cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void internalError(String msg) {
|
|
||||||
add(error, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void internalError(String msg, Throwable cause) {
|
|
||||||
add(error, msg, cause);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -135,10 +122,6 @@ public class CapturingLogger extends AbstractESLogger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void add(List<Msg> list, String text) {
|
|
||||||
list.add(new Msg(text));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void add(List<Msg> list, String text, Throwable t) {
|
private static void add(List<Msg> list, String text, Throwable t) {
|
||||||
list.add(new Msg(text, t));
|
list.add(new Msg(text, t));
|
||||||
}
|
}
|
||||||
|
@ -151,10 +134,6 @@ public class CapturingLogger extends AbstractESLogger {
|
||||||
public String text;
|
public String text;
|
||||||
public Throwable t;
|
public Throwable t;
|
||||||
|
|
||||||
public Msg(String text) {
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Msg(String text, Throwable t) {
|
public Msg(String text, Throwable t) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.t = t;
|
this.t = t;
|
||||||
|
|
|
@ -13,8 +13,8 @@ import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.component.LifecycleComponent;
|
import org.elasticsearch.common.component.LifecycleComponent;
|
||||||
import org.elasticsearch.common.inject.Module;
|
import org.elasticsearch.common.inject.Module;
|
||||||
import org.elasticsearch.common.logging.ESLogger;
|
import org.elasticsearch.common.logging.ESLogger;
|
||||||
|
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
import org.elasticsearch.common.logging.support.LoggerMessageFormat;
|
|
||||||
import org.elasticsearch.common.network.NetworkModule;
|
import org.elasticsearch.common.network.NetworkModule;
|
||||||
import org.elasticsearch.common.regex.Regex;
|
import org.elasticsearch.common.regex.Regex;
|
||||||
import org.elasticsearch.common.settings.Setting;
|
import org.elasticsearch.common.settings.Setting;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
package org.elasticsearch.watcher.actions;
|
package org.elasticsearch.watcher.actions;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.logging.support.LoggerMessageFormat;
|
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||||
import org.elasticsearch.common.xcontent.ToXContent;
|
import org.elasticsearch.common.xcontent.ToXContent;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
package org.elasticsearch.watcher.actions.throttler;
|
package org.elasticsearch.watcher.actions.throttler;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.logging.support.LoggerMessageFormat;
|
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||||
import org.elasticsearch.watcher.execution.WatchExecutionContext;
|
import org.elasticsearch.watcher.execution.WatchExecutionContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -38,7 +38,7 @@ import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import static org.elasticsearch.common.logging.support.LoggerMessageFormat.format;
|
import static org.elasticsearch.common.logging.LoggerMessageFormat.format;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.elasticsearch.script.ScriptException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static org.elasticsearch.common.logging.support.LoggerMessageFormat.format;
|
import static org.elasticsearch.common.logging.LoggerMessageFormat.format;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.watcher.support.validation;
|
package org.elasticsearch.watcher.support.validation;
|
||||||
|
|
||||||
import org.elasticsearch.common.logging.support.LoggerMessageFormat;
|
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.elasticsearch.watcher.support.validation;
|
||||||
import org.elasticsearch.ElasticsearchException;
|
import org.elasticsearch.ElasticsearchException;
|
||||||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.logging.support.LoggerMessageFormat;
|
import org.elasticsearch.common.logging.LoggerMessageFormat;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.watcher.support.Exceptions;
|
import org.elasticsearch.watcher.support.Exceptions;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.common.logging.support.LoggerMessageFormat.format;
|
import static org.elasticsearch.common.logging.LoggerMessageFormat.format;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue