All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.search.util.logging.impl.LoggerInfoStream Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
/*
 * Hibernate Search, full-text search for your domain model
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.search.util.logging.impl;

import org.apache.lucene.util.InfoStream;

import java.io.IOException;

/**
 * An implementation of {@link org.apache.lucene.util.InfoStream}
 * that redirects output to a logger
 */
public class LoggerInfoStream extends InfoStream {

	/**
	 * This is the category name of the Logger used to print out the Lucene infostream.
	 * To enable the logger, the category needs to be enabled at TRACE level and configuration
	 * property {@code org.hibernate.search.backend.configuration.impl.IndexWriterSetting#INFOSTREAM}
	 * needs to be enabled on the index.
	 *
	 * @see org.hibernate.search.backend.configuration.impl.IndexWriterSetting#INFOSTREAM
	 */
	public static final String INFOSTREAM_LOGGER_CATEGORY = "org.hibernate.search.backend.lucene.infostream";

	private final Log logger = LoggerFactory.make( INFOSTREAM_LOGGER_CATEGORY );

	@Override
	public void message(String component, String message) {
		logger.logInfoStreamMessage( component, message );
	}

	@Override
	public boolean isEnabled(String component) {
		return logger.isTraceEnabled();
	}

	@Override
	public void close() throws IOException { }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy