当前位置: 首页>>代码示例>>Java>>正文


Java Loggers.getLogger方法代码示例

本文整理汇总了Java中org.elasticsearch.common.logging.Loggers.getLogger方法的典型用法代码示例。如果您正苦于以下问题:Java Loggers.getLogger方法的具体用法?Java Loggers.getLogger怎么用?Java Loggers.getLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.logging.Loggers的用法示例。


在下文中一共展示了Loggers.getLogger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: stop

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
private Node stop() {
    if (!lifecycle.moveToStopped()) {
        return this;
    }
    Logger logger = Loggers.getLogger(Node.class, NODE_NAME_SETTING.get(settings));
    logger.info("stopping ...");

    injector.getInstance(TribeService.class).stop();
    injector.getInstance(ResourceWatcherService.class).stop();
    if (NetworkModule.HTTP_ENABLED.get(settings)) {
        injector.getInstance(HttpServerTransport.class).stop();
    }

    injector.getInstance(SnapshotsService.class).stop();
    injector.getInstance(SnapshotShardsService.class).stop();
    // stop any changes happening as a result of cluster state changes
    injector.getInstance(IndicesClusterStateService.class).stop();
    // close discovery early to not react to pings anymore.
    // This can confuse other nodes and delay things - mostly if we're the master and we're running tests.
    injector.getInstance(Discovery.class).stop();
    // we close indices first, so operations won't be allowed on it
    injector.getInstance(RoutingService.class).stop();
    injector.getInstance(ClusterService.class).stop();
    injector.getInstance(NodeConnectionsService.class).stop();
    injector.getInstance(MonitorService.class).stop();
    injector.getInstance(GatewayService.class).stop();
    injector.getInstance(SearchService.class).stop();
    injector.getInstance(TransportService.class).stop();
    injector.getInstance(SearchTransportService.class).stop();

    pluginLifecycleComponents.forEach(LifecycleComponent::stop);
    // we should stop this last since it waits for resources to get released
    // if we had scroll searchers etc or recovery going on we wait for to finish.
    injector.getInstance(IndicesService.class).stop();
    logger.info("stopped");

    return this;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:39,代码来源:Node.java

示例4: resolveLogger

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
/**
 * Obtain the logger with the given name.
 *
 * @param loggerName the logger to obtain
 * @return the logger
 */
private static Logger resolveLogger(String loggerName) {
    if (loggerName.equalsIgnoreCase("_root")) {
        return ESLoggerFactory.getRootLogger();
    }
    return Loggers.getLogger(loggerName);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:LoggingListener.java

示例5: AbstractRetryHandler

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
public AbstractRetryHandler(Class<? extends Throwable> retryOnThrowable, BackoffPolicy backoffPolicy, Client client, ActionListener<BulkResponse> listener) {
    this.retryOnThrowable = retryOnThrowable;
    this.backoff = backoffPolicy.iterator();
    this.client = client;
    this.listener = listener;
    this.logger = Loggers.getLogger(getClass(), client.settings());
    // in contrast to System.currentTimeMillis(), nanoTime() uses a monotonic clock under the hood
    this.startTimestampNanos = System.nanoTime();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:10,代码来源:Retry.java

示例6: checkJarHell

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
/**
 * Checks the current classpath for duplicate classes
 * @throws IllegalStateException if jar hell was found
 */
public static void checkJarHell() throws Exception {
    ClassLoader loader = JarHell.class.getClassLoader();
    ESLogger logger = Loggers.getLogger(JarHell.class);
    if (logger.isDebugEnabled()) {
        logger.debug("java.class.path: {}", System.getProperty("java.class.path"));
        logger.debug("sun.boot.class.path: {}", System.getProperty("sun.boot.class.path"));
        if (loader instanceof URLClassLoader ) {
            logger.debug("classloader urls: {}", Arrays.toString(((URLClassLoader)loader).getURLs()));
         }
    }
    checkJarHell(parseClassPath());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:JarHell.java

示例7: checkUnsetAndMaybeExit

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
private static void checkUnsetAndMaybeExit(String confFileSetting, String settingName) {
    if (confFileSetting != null && confFileSetting.isEmpty() == false) {
        ESLogger logger = Loggers.getLogger(Bootstrap.class);
        logger.info("{} is no longer supported. crate.yml must be placed in the config directory and cannot be renamed.", settingName);
        System.exit(1);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:BootstrapProxy.java

示例8: AbstractRetryHandler

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
AbstractRetryHandler(Class<? extends Throwable> retryOnThrowable, BackoffPolicy backoffPolicy, Client client, ActionListener<BulkResponse> listener) {
    this.retryOnThrowable = retryOnThrowable;
    this.backoff = backoffPolicy.iterator();
    this.client = client;
    this.listener = listener;
    this.logger = Loggers.getLogger(getClass(), client.settings());
    // in contrast to System.currentTimeMillis(), nanoTime() uses a monotonic clock under the hood
    this.startTimestampNanos = System.nanoTime();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:Retry.java

示例9: RecoveryStatus

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
public RecoveryStatus(IndexShard indexShard, DiscoveryNode sourceNode, RecoveryTarget.RecoveryListener listener) {

        super("recovery_status");
        this.recoveryId = idGenerator.incrementAndGet();
        this.listener = listener;
        this.logger = Loggers.getLogger(getClass(), indexShard.indexSettings(), indexShard.shardId());
        this.indexShard = indexShard;
        this.sourceNode = sourceNode;
        this.shardId = indexShard.shardId();
        this.tempFilePrefix = RECOVERY_PREFIX + indexShard.recoveryState().getTimer().startTime() + ".";
        this.store = indexShard.store();
        // make sure the store is not released until we are done.
        store.incRef();
        indexShard.recoveryStats().incCurrentAsTarget();
    }
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:16,代码来源:RecoveryStatus.java

示例10: Engine

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
protected Engine(EngineConfig engineConfig) {
    Objects.requireNonNull(engineConfig.getStore(), "Store must be provided to the engine");
    Objects.requireNonNull(engineConfig.getDeletionPolicy(), "Snapshot deletion policy must be provided to the engine");

    this.engineConfig = engineConfig;
    this.shardId = engineConfig.getShardId();
    this.store = engineConfig.getStore();
    this.logger = Loggers.getLogger(Engine.class, // we use the engine class directly here to make sure all subclasses have the same logger name
            engineConfig.getIndexSettings().getSettings(), engineConfig.getShardId());
    this.eventListener = engineConfig.getEventListener();
    this.deletionPolicy = engineConfig.getDeletionPolicy();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:Engine.java

示例11: CrateCoreModule

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
public CrateCoreModule(Settings settings, CrateComponentLoader crateComponentLoader, PluginLoader pluginLoader) {
    logger = Loggers.getLogger(getClass().getPackage().getName(), settings);
    this.crateComponentLoader = crateComponentLoader;
    this.pluginLoader = pluginLoader;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:6,代码来源:CrateCoreModule.java

示例12: Netty4InternalESLogger

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
Netty4InternalESLogger(final String name) {
    super(name);
    this.logger = Loggers.getLogger(name);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:Netty4InternalESLogger.java

示例13: OrQueryParser

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
@Inject
public OrQueryParser() {
    ESLogger logger = Loggers.getLogger(getClass());
    deprecationLogger = new DeprecationLogger(logger);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:6,代码来源:OrQueryParser.java

示例14: testCustomLevelPerClassAndPerMethod

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
public void testCustomLevelPerClassAndPerMethod() throws Exception {
    LoggingListener loggingListener = new LoggingListener();

    Description suiteDescription = Description.createSuiteDescription(AnnotatedTestClass.class);

    Logger abcLogger = Loggers.getLogger("abc");
    Logger xyzLogger = Loggers.getLogger("xyz");

    final Level level = ESLoggerFactory.getRootLogger().getLevel();

    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(level));
    loggingListener.testRunStarted(suiteDescription);
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(Level.WARN));

    Method method = TestClass.class.getMethod("annotatedTestMethod");
    TestLogging annotation = method.getAnnotation(TestLogging.class);
    Description testDescription = Description.createTestDescription(LoggingListenerTests.class, "annotatedTestMethod", annotation);
    loggingListener.testStarted(testDescription);
    assertThat(xyzLogger.getLevel(), equalTo(Level.TRACE));
    assertThat(abcLogger.getLevel(), equalTo(Level.WARN));

    loggingListener.testFinished(testDescription);
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(Level.WARN));

    Method method2 = TestClass.class.getMethod("annotatedTestMethod2");
    TestLogging annotation2 = method2.getAnnotation(TestLogging.class);
    Description testDescription2 = Description.createTestDescription(LoggingListenerTests.class, "annotatedTestMethod2", annotation2);
    loggingListener.testStarted(testDescription2);
    assertThat(xyzLogger.getLevel(), equalTo(Level.DEBUG));
    assertThat(abcLogger.getLevel(), equalTo(Level.TRACE));

    loggingListener.testFinished(testDescription2);
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(Level.WARN));

    loggingListener.testRunFinished(new Result());
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(level));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:43,代码来源:LoggingListenerTests.java

示例15: CrateRestFilter

import org.elasticsearch.common.logging.Loggers; //导入方法依赖的package包/类
@Inject
public CrateRestFilter(Settings settings) {
    this.esApiEnabled = settings.getAsBoolean(ES_API_ENABLED_SETTING, true);
    ESLogger logger = Loggers.getLogger(getClass().getPackage().getName(), settings);
    logger.info("Elasticsearch HTTP REST API {}enabled", esApiEnabled ? "" : "not ");
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:CrateRestFilter.java


注:本文中的org.elasticsearch.common.logging.Loggers.getLogger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。