Java Code Examples for org.elasticsearch.common.logging.ESLogger#setLevel()

The following examples show how to use org.elasticsearch.common.logging.ESLogger#setLevel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlobService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void doStart() throws ElasticsearchException {
    logger.info("BlobService.doStart() {}", this);

    // suppress warning about replaced recovery handler
    ESLogger transportServiceLogger = Loggers.getLogger(TransportService.class);
    String previousLevel = transportServiceLogger.getLevel();
    transportServiceLogger.setLevel("ERROR");
    injector.getInstance(BlobRecoverySource.class).registerHandler();
    transportServiceLogger.setLevel(previousLevel);

    // validate the optional blob path setting
    String globalBlobPathPrefix = settings.get(BlobEnvironment.SETTING_BLOBS_PATH);
    if (globalBlobPathPrefix != null) {
        blobEnvironment.blobsPath(new File(globalBlobPathPrefix));
    }

    blobHeadRequestHandler.registerHandler();

    // by default the http server is started after the discovery service.
    // For the BlobService this is too late.

    // The HttpServer has to be started before so that the boundAddress
    // can be added to DiscoveryNodes - this is required for the redirect logic.
    if (settings.getAsBoolean("http.enabled", true)) {
        injector.getInstance(HttpServer.class).start();
    } else {
        logger.warn("Http server should be enabled for blob support");
    }
}
 
Example 2
Source File: IndexingSlowLog.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
/**
 * Build with the specified loggers. Only used to testing.
 */
IndexingSlowLog(Settings indexSettings, ESLogger indexLogger, ESLogger deleteLogger) {
    this.indexLogger = indexLogger;
    this.deleteLogger = deleteLogger;
    this.reformat = indexSettings.getAsBoolean(INDEX_INDEXING_SLOWLOG_REFORMAT, true);
    this.indexWarnThreshold = indexSettings.getAsTime(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_WARN, TimeValue.timeValueNanos(-1)).nanos();
    this.indexInfoThreshold = indexSettings.getAsTime(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_INFO, TimeValue.timeValueNanos(-1)).nanos();
    this.indexDebugThreshold = indexSettings.getAsTime(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_DEBUG, TimeValue.timeValueNanos(-1)).nanos();
    this.indexTraceThreshold = indexSettings.getAsTime(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_TRACE, TimeValue.timeValueNanos(-1)).nanos();
    this.level = indexSettings.get(INDEX_INDEXING_SLOWLOG_LEVEL, "TRACE").toUpperCase(Locale.ROOT);
    this.maxSourceCharsToLog = readSourceToLog(indexSettings);

    indexLogger.setLevel(level);
    deleteLogger.setLevel(level);
}