Java Code Examples for org.elasticsearch.common.logging.Loggers#getLogger()

The following examples show how to use org.elasticsearch.common.logging.Loggers#getLogger() . 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: SearchSlowLog.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
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);
    }
 
Example 2
Source File: ElasticsearchConcurrentMergeScheduler.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public ElasticsearchConcurrentMergeScheduler(ShardId shardId, Settings indexSettings, MergeSchedulerConfig config) {
    this.config = config;
    this.shardId = shardId;
    this.indexSettings = indexSettings;
    this.logger = Loggers.getLogger(getClass(), indexSettings, shardId);
    refreshConfig();
}
 
Example 3
Source File: AbstractIndexComponent.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a new index component, with the index name and its settings.
 *
 * @param index         The index name
 * @param indexSettings The index settings
 */
protected AbstractIndexComponent(Index index, Settings indexSettings) {
    this.index = index;
    this.indexSettings = indexSettings;
    this.logger = Loggers.getLogger(getClass(), indexSettings, index);
    this.deprecationLogger = new DeprecationLogger(logger);
}
 
Example 4
Source File: DefaultRequestHandler.java    From elasticsearch-taste with Apache License 2.0 5 votes vote down vote up
public DefaultRequestHandler(final Settings settings, final Client client, final ThreadPool pool) {
    this.settings = settings;
    this.client = client;
    this.pool = pool;
    maxRetryCount = settings.getAsInt("taste.rest.retry", 20);
    logger = Loggers.getLogger(getClass(), settings);
    indexCreationLock = new ReentrantLock();
}
 
Example 5
Source File: CompositeIndexEventListener.java    From crate with Apache License 2.0 5 votes vote down vote up
CompositeIndexEventListener(IndexSettings indexSettings, Collection<IndexEventListener> listeners) {
    for (IndexEventListener listener : listeners) {
        if (listener == null) {
            throw new IllegalArgumentException("listeners must be non-null");
        }
    }
    this.listeners = Collections.unmodifiableList(new ArrayList<>(listeners));
    this.logger = Loggers.getLogger(getClass(), indexSettings.getIndex());
}
 
Example 6
Source File: Bootstrap.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
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. elasticsearch.yml must be placed in the config directory and cannot be renamed.", settingName);
        exit(1);
    }
}
 
Example 7
Source File: ElasticsearchConcurrentMergeScheduler.java    From crate with Apache License 2.0 5 votes vote down vote up
ElasticsearchConcurrentMergeScheduler(ShardId shardId, IndexSettings indexSettings) {
    this.config = indexSettings.getMergeSchedulerConfig();
    this.shardId = shardId;
    this.indexSettings = indexSettings.getSettings();
    this.logger = Loggers.getLogger(getClass(), shardId);
    refreshConfig();
}
 
Example 8
Source File: Engine.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
protected Engine(EngineConfig engineConfig) {
    Preconditions.checkNotNull(engineConfig.getStore(), "Store must be provided to the engine");
    Preconditions.checkNotNull(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(), engineConfig.getShardId());
    this.failedEngineListener = engineConfig.getFailedEngineListener();
    this.deletionPolicy = engineConfig.getDeletionPolicy();
}
 
Example 9
Source File: InternalRowDownstreamFactory.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public InternalRowDownstreamFactory(Settings settings,
                                    ClusterService clusterService,
                                    TransportDistributedResultAction transportDistributedResultAction) {
    super(settings);
    this.clusterService = clusterService;
    this.transportDistributedResultAction = transportDistributedResultAction;
    distributingDownstreamLogger = Loggers.getLogger(DistributingDownstream.class, settings);
}
 
Example 10
Source File: TransportService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportService(Settings settings, Transport transport, ThreadPool threadPool) {
    super(settings);
    this.transport = transport;
    this.threadPool = threadPool;
    this.tracerLogInclude = settings.getAsArray(SETTING_TRACE_LOG_INCLUDE, DEFAULT_TRACE_LOG_INCLUDE, true);
    this.tracelLogExclude = settings.getAsArray(SETTING_TRACE_LOG_EXCLUDE, DEFAULT_TRACE_LOG_EXCLUDE, true);
    tracerLog = Loggers.getLogger(logger, ".tracer");
    adapter = createAdapter();
    taskManager = createTaskManager();
}
 
Example 11
Source File: CrateCoreModule.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public CrateCoreModule(Settings settings, CrateComponentLoader crateComponentLoader, PluginLoader pluginLoader) {
    logger = Loggers.getLogger(getClass().getPackage().getName(), settings);
    this.crateComponentLoader = crateComponentLoader;
    this.pluginLoader = pluginLoader;
}
 
Example 12
Source File: LoggerInfoStream.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public LoggerInfoStream(ESLogger parentLogger) {
    logger = Loggers.getLogger(parentLogger, ".lucene.iw");
    ifdLogger = Loggers.getLogger(parentLogger, ".lucene.iw.ifd");
}
 
Example 13
Source File: AbstractIndexShardComponent.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
protected AbstractIndexShardComponent(ShardId shardId, Settings indexSettings) {
    this.shardId = shardId;
    this.indexSettings = indexSettings;
    this.logger = Loggers.getLogger(getClass(), indexSettings, shardId);
    this.deprecationLogger = new DeprecationLogger(logger);
}
 
Example 14
Source File: MissingQueryParser.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public MissingQueryParser() {
    ESLogger logger = Loggers.getLogger(getClass());
    deprecationLogger = new DeprecationLogger(logger);
}
 
Example 15
Source File: NettyInternalESLoggerFactory.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public InternalLogger newInstance(String name) {
    return new NettyInternalESLogger(Loggers.getLogger(name));
}
 
Example 16
Source File: PluginsService.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
static List<Bundle> getPluginBundles(Path pluginsDirectory) throws IOException {
    ESLogger logger = Loggers.getLogger(PluginsService.class);

    // TODO: remove this leniency, but tests bogusly rely on it
    if (!isAccessibleDirectory(pluginsDirectory, logger)) {
        return Collections.emptyList();
    }

    List<Bundle> bundles = new ArrayList<>();
    // a special purgatory for plugins that directly depend on each other
    bundles.add(new Bundle());

    try (DirectoryStream<Path> stream = Files.newDirectoryStream(pluginsDirectory)) {
        for (Path plugin : stream) {
            if (FileSystemUtils.isHidden(plugin)) {
                logger.trace("--- skip hidden plugin file[{}]", plugin.toAbsolutePath());
                continue;
            }
            if (!FileSystemUtils.isAccessibleDirectory(plugin, logger)) {
                continue;
            }
            PluginInfo info;
            try {
                info = PluginInfo.readFromProperties(plugin);
            } catch (NoSuchFileException e) {
                // es plugin descriptor file not found, ignore, could be a Crate plugin
                logger.trace("--- plugin descriptor file not found, ignoring plugin [{}]", plugin.toAbsolutePath());
                continue;
            }
            logger.trace("--- adding plugin [{}]", plugin.toAbsolutePath());
            List<URL> urls = new ArrayList<>();
            if (info.isJvm()) {
                // a jvm plugin: gather urls for jar files
                try (DirectoryStream<Path> jarStream = Files.newDirectoryStream(plugin, "*.jar")) {
                    for (Path jar : jarStream) {
                        // normalize with toRealPath to get symlinks out of our hair
                        urls.add(jar.toRealPath().toUri().toURL());
                    }
                }
            }
            final Bundle bundle;
            if (info.isJvm() && info.isIsolated() == false) {
                bundle = bundles.get(0); // purgatory
            } else {
                bundle = new Bundle();
                bundles.add(bundle);
            }
            bundle.plugins.add(info);
            bundle.urls.addAll(urls);
        }
    }

    return bundles;
}
 
Example 17
Source File: BulkRequestHandler.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
protected BulkRequestHandler(Client client) {
    this.client = client;
    this.logger = Loggers.getLogger(getClass(), client.settings());
}
 
Example 18
Source File: FQueryFilterParser.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public FQueryFilterParser() {
    ESLogger logger = Loggers.getLogger(getClass());
    deprecationLogger = new DeprecationLogger(logger);
}
 
Example 19
Source File: AndQueryParser.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public AndQueryParser() {
    ESLogger logger = Loggers.getLogger(getClass());
    deprecationLogger = new DeprecationLogger(logger);
}
 
Example 20
Source File: FilteredQueryParser.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public FilteredQueryParser() {
    ESLogger logger = Loggers.getLogger(getClass());
    deprecationLogger = new DeprecationLogger(logger);
}