当前位置: 首页>>代码示例>>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;未经允许,请勿转载。