當前位置: 首頁>>代碼示例>>Java>>正文


Java Loggers類代碼示例

本文整理匯總了Java中org.elasticsearch.common.logging.Loggers的典型用法代碼示例。如果您正苦於以下問題:Java Loggers類的具體用法?Java Loggers怎麽用?Java Loggers使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Loggers類屬於org.elasticsearch.common.logging包,在下文中一共展示了Loggers類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: RecoverySourceHandler

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
public RecoverySourceHandler(final IndexShard shard, RecoveryTargetHandler recoveryTarget,
                             final StartRecoveryRequest request,
                             final Supplier<Long> currentClusterStateVersionSupplier,
                             Function<String, Releasable> delayNewRecoveries,
                             final int fileChunkSizeInBytes,
                             final Settings nodeSettings) {
    this.shard = shard;
    this.recoveryTarget = recoveryTarget;
    this.request = request;
    this.currentClusterStateVersionSupplier = currentClusterStateVersionSupplier;
    this.delayNewRecoveries = delayNewRecoveries;
    this.indexName = this.request.shardId().getIndex().getName();
    this.shardId = this.request.shardId().id();
    this.logger = Loggers.getLogger(getClass(), nodeSettings, request.shardId(), "recover to " + request.targetNode().getName());
    this.chunkSizeInBytes = fileChunkSizeInBytes;
    this.response = new RecoveryResponse();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:18,代碼來源:RecoverySourceHandler.java

示例2: RecoveryTarget

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
/**
 * Creates a new recovery target object that represents a recovery to the provided shard.
 *
 * @param indexShard                        local shard where we want to recover to
 * @param sourceNode                        source node of the recovery where we recover from
 * @param listener                          called when recovery is completed/failed
 * @param ensureClusterStateVersionCallback callback to ensure that the current node is at least on a cluster state with the provided
 *                                          version; necessary for primary relocation so that new primary knows about all other ongoing
 *                                          replica recoveries when replicating documents (see {@link RecoverySourceHandler})
 */
public RecoveryTarget(final IndexShard indexShard,
               final DiscoveryNode sourceNode,
               final PeerRecoveryTargetService.RecoveryListener listener,
               final Callback<Long> ensureClusterStateVersionCallback) {
    super("recovery_status");
    this.cancellableThreads = new CancellableThreads();
    this.recoveryId = idGenerator.incrementAndGet();
    this.listener = listener;
    this.logger = Loggers.getLogger(getClass(), indexShard.indexSettings().getSettings(), indexShard.shardId());
    this.indexShard = indexShard;
    this.sourceNode = sourceNode;
    this.shardId = indexShard.shardId();
    this.tempFilePrefix = RECOVERY_PREFIX + UUIDs.base64UUID() + ".";
    this.store = indexShard.store();
    this.ensureClusterStateVersionCallback = ensureClusterStateVersionCallback;
    // make sure the store is not released until we are done.
    store.incRef();
    indexShard.recoveryStats().incCurrentAsTarget();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:30,代碼來源:RecoveryTarget.java

示例3: SearchSlowLog

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
public SearchSlowLog(IndexSettings indexSettings) {

        this.queryLogger = Loggers.getLogger(INDEX_SEARCH_SLOWLOG_PREFIX + ".query", indexSettings.getSettings());
        this.fetchLogger = Loggers.getLogger(INDEX_SEARCH_SLOWLOG_PREFIX + ".fetch", indexSettings.getSettings());

        indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_WARN_SETTING, this::setQueryWarnThreshold);
        this.queryWarnThreshold = indexSettings.getValue(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_WARN_SETTING).nanos();
        indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_INFO_SETTING, this::setQueryInfoThreshold);
        this.queryInfoThreshold = indexSettings.getValue(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_INFO_SETTING).nanos();
        indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_DEBUG_SETTING, this::setQueryDebugThreshold);
        this.queryDebugThreshold = indexSettings.getValue(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_DEBUG_SETTING).nanos();
        indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_TRACE_SETTING, this::setQueryTraceThreshold);
        this.queryTraceThreshold = indexSettings.getValue(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_TRACE_SETTING).nanos();

        indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_WARN_SETTING, this::setFetchWarnThreshold);
        this.fetchWarnThreshold = indexSettings.getValue(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_WARN_SETTING).nanos();
        indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_INFO_SETTING, this::setFetchInfoThreshold);
        this.fetchInfoThreshold = indexSettings.getValue(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_INFO_SETTING).nanos();
        indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_DEBUG_SETTING, this::setFetchDebugThreshold);
        this.fetchDebugThreshold = indexSettings.getValue(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_DEBUG_SETTING).nanos();
        indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_TRACE_SETTING, this::setFetchTraceThreshold);
        this.fetchTraceThreshold = indexSettings.getValue(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_TRACE_SETTING).nanos();

        indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_SEARCH_SLOWLOG_LEVEL, this::setLevel);
        setLevel(indexSettings.getValue(INDEX_SEARCH_SLOWLOG_LEVEL));
    }
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:27,代碼來源:SearchSlowLog.java

示例4: IndexingSlowLog

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
IndexingSlowLog(IndexSettings indexSettings) {
    this.indexLogger = Loggers.getLogger(INDEX_INDEXING_SLOWLOG_PREFIX + ".index", indexSettings.getSettings());
    this.index = indexSettings.getIndex();

    indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_INDEXING_SLOWLOG_REFORMAT_SETTING, this::setReformat);
    this.reformat = indexSettings.getValue(INDEX_INDEXING_SLOWLOG_REFORMAT_SETTING);
    indexSettings.getScopedSettings()
            .addSettingsUpdateConsumer(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_WARN_SETTING, this::setWarnThreshold);
    this.indexWarnThreshold = indexSettings.getValue(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_WARN_SETTING).nanos();
    indexSettings.getScopedSettings()
            .addSettingsUpdateConsumer(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_INFO_SETTING, this::setInfoThreshold);
    this.indexInfoThreshold = indexSettings.getValue(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_INFO_SETTING).nanos();
    indexSettings.getScopedSettings()
            .addSettingsUpdateConsumer(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_DEBUG_SETTING, this::setDebugThreshold);
    this.indexDebugThreshold = indexSettings.getValue(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_DEBUG_SETTING).nanos();
    indexSettings.getScopedSettings()
            .addSettingsUpdateConsumer(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_TRACE_SETTING, this::setTraceThreshold);
    this.indexTraceThreshold = indexSettings.getValue(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_TRACE_SETTING).nanos();
    indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_INDEXING_SLOWLOG_LEVEL_SETTING, this::setLevel);
    setLevel(indexSettings.getValue(INDEX_INDEXING_SLOWLOG_LEVEL_SETTING));
    indexSettings.getScopedSettings().addSettingsUpdateConsumer(INDEX_INDEXING_SLOWLOG_MAX_SOURCE_CHARS_TO_LOG_SETTING,
            this::setMaxSourceCharsToLog);
    this.maxSourceCharsToLog = indexSettings.getValue(INDEX_INDEXING_SLOWLOG_MAX_SOURCE_CHARS_TO_LOG_SETTING);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:25,代碼來源:IndexingSlowLog.java

示例5: TransportService

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
/**
 * Build the service.
 *
 * @param clusterSettings if non null the the {@linkplain TransportService} will register with the {@link ClusterSettings} for settings
 *        updates for {@link #TRACE_LOG_EXCLUDE_SETTING} and {@link #TRACE_LOG_INCLUDE_SETTING}.
 */
public TransportService(Settings settings, Transport transport, ThreadPool threadPool, TransportInterceptor transportInterceptor,
                        Function<BoundTransportAddress, DiscoveryNode> localNodeFactory, @Nullable ClusterSettings clusterSettings) {
    super(settings);
    this.transport = transport;
    this.threadPool = threadPool;
    this.localNodeFactory = localNodeFactory;
    this.clusterName = ClusterName.CLUSTER_NAME_SETTING.get(settings);
    setTracerLogInclude(TRACE_LOG_INCLUDE_SETTING.get(settings));
    setTracerLogExclude(TRACE_LOG_EXCLUDE_SETTING.get(settings));
    tracerLog = Loggers.getLogger(logger, ".tracer");
    adapter = createAdapter();
    taskManager = createTaskManager();
    this.interceptor = transportInterceptor;
    this.asyncSender = interceptor.interceptSender(this::sendRequestInternal);
    if (clusterSettings != null) {
        clusterSettings.addSettingsUpdateConsumer(TRACE_LOG_INCLUDE_SETTING, this::setTracerLogInclude);
        clusterSettings.addSettingsUpdateConsumer(TRACE_LOG_EXCLUDE_SETTING, this::setTracerLogExclude);
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:26,代碼來源:TransportService.java

示例6: randomPercents

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
private static double[] randomPercents(long minValue, long maxValue) {
    final int length = randomIntBetween(1, 20);
    final double[] percents = new double[length];
    for (int i = 0; i < percents.length; ++i) {
        switch (randomInt(20)) {
        case 0:
            percents[i] = minValue;
            break;
        case 1:
            percents[i] = maxValue;
            break;
        default:
            percents[i] = (randomDouble() * (maxValue - minValue)) + minValue;
            break;
        }
    }
    Arrays.sort(percents);
    Loggers.getLogger(HDRPercentileRanksIT.class).info("Using values={}", Arrays.toString(percents));
    return percents;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:21,代碼來源:HDRPercentileRanksIT.java

示例7: randomPercentiles

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
private static double[] randomPercentiles() {
    final int length = randomIntBetween(1, 20);
    final double[] percentiles = new double[length];
    for (int i = 0; i < percentiles.length; ++i) {
        switch (randomInt(20)) {
        case 0:
            percentiles[i] = 0;
            break;
        case 1:
            percentiles[i] = 100;
            break;
        default:
            percentiles[i] = randomDouble() * 100;
            break;
        }
    }
    Arrays.sort(percentiles);
    Loggers.getLogger(HDRPercentilesIT.class).info("Using percentiles={}", Arrays.toString(percentiles));
    return percentiles;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:21,代碼來源:HDRPercentilesIT.java

示例8: randomPercentiles

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
private static double[] randomPercentiles() {
    final int length = randomIntBetween(1, 20);
    final double[] percentiles = new double[length];
    for (int i = 0; i < percentiles.length; ++i) {
        switch (randomInt(20)) {
        case 0:
            percentiles[i] = 0;
            break;
        case 1:
            percentiles[i] = 100;
            break;
        default:
            percentiles[i] = randomDouble() * 100;
            break;
        }
    }
    Arrays.sort(percentiles);
    Loggers.getLogger(TDigestPercentilesIT.class).info("Using percentiles={}", Arrays.toString(percentiles));
    return percentiles;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:21,代碼來源:TDigestPercentilesIT.java

示例9: randomPercents

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
private static double[] randomPercents(long minValue, long maxValue) {

        final int length = randomIntBetween(1, 20);
        final double[] percents = new double[length];
        for (int i = 0; i < percents.length; ++i) {
            switch (randomInt(20)) {
            case 0:
                percents[i] = minValue;
                break;
            case 1:
                percents[i] = maxValue;
                break;
            default:
                percents[i] = (randomDouble() * (maxValue - minValue)) + minValue;
                break;
            }
        }
        Arrays.sort(percents);
        Loggers.getLogger(TDigestPercentileRanksIT.class).info("Using values={}", Arrays.toString(percents));
        return percents;
    }
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:22,代碼來源:TDigestPercentileRanksIT.java

示例10: testLoggingUpdates

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
public void testLoggingUpdates() {
    final Level level = ESLoggerFactory.getRootLogger().getLevel();
    final Level testLevel = ESLoggerFactory.getLogger("test").getLevel();
    Level property = randomFrom(Level.values());
    Settings.Builder builder = Settings.builder().put("logger.level", property);
    try {
        ClusterSettings settings = new ClusterSettings(builder.build(), ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
        IllegalArgumentException ex =
            expectThrows(
                IllegalArgumentException.class,
                () -> settings.validate(Settings.builder().put("logger._root", "boom").build()));
        assertEquals("Unknown level constant [BOOM].", ex.getMessage());
        assertEquals(level, ESLoggerFactory.getRootLogger().getLevel());
        settings.applySettings(Settings.builder().put("logger._root", "TRACE").build());
        assertEquals(Level.TRACE, ESLoggerFactory.getRootLogger().getLevel());
        settings.applySettings(Settings.builder().build());
        assertEquals(property, ESLoggerFactory.getRootLogger().getLevel());
        settings.applySettings(Settings.builder().put("logger.test", "TRACE").build());
        assertEquals(Level.TRACE, ESLoggerFactory.getLogger("test").getLevel());
        settings.applySettings(Settings.builder().build());
        assertEquals(property, ESLoggerFactory.getLogger("test").getLevel());
    } finally {
        Loggers.setLevel(ESLoggerFactory.getRootLogger(), level);
        Loggers.setLevel(ESLoggerFactory.getLogger("test"), testLevel);
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:27,代碼來源:ScopedSettingsTests.java

示例11: ContextPreparer

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
@Inject
public ContextPreparer(Settings settings,
                       MapSideDataCollectOperation collectOperation,
                       ClusterService clusterService,
                       CrateCircuitBreakerService breakerService,
                       CountOperation countOperation,
                       ThreadPool threadPool,
                       PageDownstreamFactory pageDownstreamFactory,
                       RowDownstreamFactory rowDownstreamFactory) {
    super(settings);
    nlContextLogger = Loggers.getLogger(NestedLoopContext.class, settings);
    pageDownstreamContextLogger = Loggers.getLogger(PageDownstreamContext.class, settings);
    this.collectOperation = collectOperation;
    this.clusterService = clusterService;
    this.countOperation = countOperation;
    this.threadPool = threadPool;
    circuitBreaker = breakerService.getBreaker(CrateCircuitBreakerService.QUERY);
    this.pageDownstreamFactory = pageDownstreamFactory;
    this.rowDownstreamFactory = rowDownstreamFactory;
    innerPreparer = new InnerPreparer();
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:22,代碼來源:ContextPreparer.java

示例12: ScriptParameterParser

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
public ScriptParameterParser(Set<String> parameterNames) {
    ESLogger logger = Loggers.getLogger(getClass());
    deprecationLogger = new DeprecationLogger(logger);
    if (parameterNames == null || parameterNames.isEmpty()) {
        inlineParameters = Collections.singleton(ScriptService.SCRIPT_INLINE);
        fileParameters = Collections.singleton(ScriptService.SCRIPT_FILE);
        indexedParameters = Collections.singleton(ScriptService.SCRIPT_ID);
    } else {
        inlineParameters = new HashSet<>();
        fileParameters = new HashSet<>();
        indexedParameters = new HashSet<>();
        for (String parameterName : parameterNames) {
            if (ParseFieldMatcher.EMPTY.match(parameterName, ScriptService.SCRIPT_LANG)) {
                throw new IllegalArgumentException("lang is reserved and cannot be used as a parameter name");
            }
            inlineParameters.add(new ParseField(parameterName));
            fileParameters.add(new ParseField(parameterName + FILE_SUFFIX));
            indexedParameters.add(new ParseField(parameterName + INDEXED_SUFFIX));
        }
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:22,代碼來源:ScriptParameterParser.java

示例13: configure

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
@Override
protected void configure() {
    MapBinder<String, NativeScriptFactory> scriptsBinder
            = MapBinder.newMapBinder(binder(), String.class, NativeScriptFactory.class);
    for (Map.Entry<String, Class<? extends NativeScriptFactory>> entry : scripts.entrySet()) {
        scriptsBinder.addBinding(entry.getKey()).to(entry.getValue()).asEagerSingleton();
    }

    Multibinder<ScriptEngineService> multibinder = Multibinder.newSetBinder(binder(), ScriptEngineService.class);
    multibinder.addBinding().to(NativeScriptEngineService.class);
    
    try {
        Class.forName("com.github.mustachejava.Mustache");
        multibinder.addBinding().to(MustacheScriptEngineService.class).asEagerSingleton();
    } catch (Throwable t) {
        Loggers.getLogger(ScriptService.class, settings).debug("failed to load mustache", t);
    }

    for (Class<? extends ScriptEngineService> scriptEngine : scriptEngines) {
        multibinder.addBinding().to(scriptEngine).asEagerSingleton();
    }

    bind(ScriptContextRegistry.class).toInstance(new ScriptContextRegistry(customScriptContexts));
    bind(ScriptService.class).asEagerSingleton();
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:26,代碼來源:ScriptModule.java

示例14: SearchSlowLog

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
SearchSlowLog(Settings indexSettings) {

        this.reformat = indexSettings.getAsBoolean(INDEX_SEARCH_SLOWLOG_REFORMAT, true);

        this.queryWarnThreshold = indexSettings.getAsTime(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_WARN, TimeValue.timeValueNanos(-1)).nanos();
        this.queryInfoThreshold = indexSettings.getAsTime(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_INFO, TimeValue.timeValueNanos(-1)).nanos();
        this.queryDebugThreshold = indexSettings.getAsTime(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_DEBUG, TimeValue.timeValueNanos(-1)).nanos();
        this.queryTraceThreshold = indexSettings.getAsTime(INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_TRACE, TimeValue.timeValueNanos(-1)).nanos();

        this.fetchWarnThreshold = indexSettings.getAsTime(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_WARN, TimeValue.timeValueNanos(-1)).nanos();
        this.fetchInfoThreshold = indexSettings.getAsTime(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_INFO, TimeValue.timeValueNanos(-1)).nanos();
        this.fetchDebugThreshold = indexSettings.getAsTime(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_DEBUG, TimeValue.timeValueNanos(-1)).nanos();
        this.fetchTraceThreshold = indexSettings.getAsTime(INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_TRACE, TimeValue.timeValueNanos(-1)).nanos();

        this.level = indexSettings.get(INDEX_SEARCH_SLOWLOG_LEVEL, "TRACE").toUpperCase(Locale.ROOT);

        this.queryLogger = Loggers.getLogger(INDEX_SEARCH_SLOWLOG_PREFIX + ".query");
        this.fetchLogger = Loggers.getLogger(INDEX_SEARCH_SLOWLOG_PREFIX + ".fetch");

        queryLogger.setLevel(level);
        fetchLogger.setLevel(level);
    }
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:23,代碼來源:SearchSlowLog.java

示例15: HttpProcessor

import org.elasticsearch.common.logging.Loggers; //導入依賴的package包/類
HttpProcessor(String tag, String field, String targetField, String urlPrefix, String extraHeader,
              boolean ignoreMissing) throws IOException {
    super(tag);
    this.field = field;
    this.urlPrefix = urlPrefix;
    this.targetField = targetField;
    this.ignoreMissing = ignoreMissing;
    this.extraHeader = extraHeader;
    this.logger = Loggers.getLogger(IngestHttpPlugin.class);
}
 
開發者ID:kosho,項目名稱:ingest-http,代碼行數:11,代碼來源:HttpProcessor.java


注:本文中的org.elasticsearch.common.logging.Loggers類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。