diff src/luan/modules/lucene/LuceneIndex.java @ 1454:219f2b937f2b

remove log4j
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 08 Mar 2020 14:11:30 -0600
parents 928be2a4d565
children 6b6c11c9164e
line wrap: on
line diff
--- a/src/luan/modules/lucene/LuceneIndex.java	Mon Mar 02 15:09:10 2020 -0700
+++ b/src/luan/modules/lucene/LuceneIndex.java	Sun Mar 08 14:11:30 2020 -0600
@@ -86,7 +86,7 @@
 
 
 public final class LuceneIndex {
-	private static final Logger sysLogger = LoggerFactory.getLogger(LuceneIndex.class);
+	private static final Logger logger = LoggerFactory.getLogger(LuceneIndex.class);
 
 	private static Map<String,Reference<LuceneIndex>> indexes = new HashMap<String,Reference<LuceneIndex>>();
 
@@ -116,7 +116,6 @@
 	public static final StringFieldParser STRING_FIELD_PARSER = new StringFieldParser(new KeywordAnalyzer());
 	public static final StringFieldParser ENGLISH_FIELD_PARSER = new StringFieldParser(new EnglishAnalyzer(luceneVersion));
 
-	private final Logger luanLogger;
 	private final Object version;
 
 	private final ReentrantLock writeLock = new ReentrantLock();
@@ -151,7 +150,6 @@
 		LuanTable postgresSpec = Utils.removeTable(options,"postgres_spec");
 		Utils.checkEmpty(options);
 
-		this.luanLogger = luan.getLogger(LuceneIndex.class);
 //		this.defaultFieldParser = defaultFieldParser;
 //		this.defaultFields = defaultFields;
 		mfp = defaultFieldParser==null ? new MultiFieldParser() : new MultiFieldParser(defaultFieldParser,defaultFields);
@@ -170,11 +168,11 @@
 		} else {
 			postgresBackup = new PostgresBackup(luan,postgresSpec);
 			if( !wasCreated && postgresBackup.wasCreated ) {
-				luanLogger.error("rebuilding postgres backup");
+				logger.error("rebuilding postgres backup");
 				rebuild_postgres_backup(luan);
 /*
 			} else if( wasCreated && !postgresBackup.wasCreated ) {
-				luanLogger.error("restoring from postgres");
+				logger.error("restoring from postgres");
 				restore_from_postgres();
 */
 			}
@@ -806,7 +804,7 @@
 	public void rebuild_postgres_backup(Luan luan)
 		throws IOException, LuanException, SQLException
 	{
-		luanLogger.info("start rebuild_postgres_backup");
+		logger.info("start rebuild_postgres_backup");
 		writeLock.lock();
 		IndexSearcher searcher = openSearcher();
 		boolean ok = false;
@@ -840,14 +838,14 @@
 				postgresBackup.rollback();
 			writeLock.unlock();
 		}
-		luanLogger.info("end rebuild_postgres_backup");
+		logger.info("end rebuild_postgres_backup");
 	}
 
 	public void restore_from_postgres(LuanFunction completer)
 		throws IOException, LuanException, SQLException, ParseException
 	{
 		if( postgresBackup!=null && wasCreated && !postgresBackup.wasCreated ) {
-			luanLogger.error("restoring from postgres");
+			logger.error("restoring from postgres");
 			force_restore_from_postgres(completer);
 		}
 	}
@@ -855,7 +853,7 @@
 	public void force_restore_from_postgres(LuanFunction completer)
 		throws IOException, LuanException, SQLException, ParseException
 	{
-		luanLogger.warn("start restore_from_postgres");
+		logger.warn("start restore_from_postgres");
 		if( postgresBackup==null )
 			throw new NullPointerException();
 		if( writeLock.isHeldByCurrentThread() )
@@ -879,7 +877,7 @@
 			wrote();
 			writeLock.unlock();
 		}
-		luanLogger.warn("end restore_from_postgres");
+		logger.warn("end restore_from_postgres");
 	}
 
 	void restore(LuanFunction completer,LuanTable doc)
@@ -893,19 +891,19 @@
 		String msg = "start check";
 		if( hasPostgres )
 			msg += " with postgres";
-		luanLogger.info(msg);
+		logger.info(msg);
 		CheckIndex.Status status = new CheckIndex(fsDir).checkIndex();
 		if( !status.clean )
-			luanLogger.error("index not clean");
+			logger.error("index not clean");
 		if( hasPostgres )
 			checkPostgres(luan);
-		luanLogger.info("end check");
+		logger.info("end check");
 	}
 
 	private void checkPostgres(Luan luan)
 		throws IOException, SQLException, LuanException, ParseException
 	{
-		//luanLogger.info("start postgres check");
+		//logger.info("start postgres check");
 		final PostgresBackup.Checker postgresChecker = postgresBackup.newChecker();
 		final IndexSearcher searcher = openSearcher();
 		try {
@@ -967,7 +965,7 @@
 	private void checkPostgres(Luan luan,PostgresBackup.Checker postgresChecker,LuanToString lts,long id)
 		throws IOException, SQLException, LuanException, ParseException
 	{
-		//luanLogger.info("check id "+id);
+		//logger.info("check id "+id);
 		writeLock.lock();
 		try {
 			final IndexSearcher searcher = openSearcher();
@@ -984,17 +982,17 @@
 					throw new RuntimeException();
 				if( docPostgres == null ) {
 					if( docLucene != null )
-						luanLogger.error("id "+id+" found in lucene but not postgres");
+						logger.error("id "+id+" found in lucene but not postgres");
 					return;
 				}
 				if( docLucene == null ) {
-					luanLogger.error("id "+id+" found in postgres but not lucene");
+					logger.error("id "+id+" found in postgres but not lucene");
 					return;
 				}
 				if( !equal(docPostgres,docLucene) ) {
-					luanLogger.error("id "+id+" not equal");
-					luanLogger.error("lucene = "+lts.toString(docLucene));
-					luanLogger.error("postgres = "+lts.toString(docPostgres));
+					logger.error("id "+id+" not equal");
+					logger.error("lucene = "+lts.toString(docLucene));
+					logger.error("postgres = "+lts.toString(docPostgres));
 				}
 			} finally {
 				close(searcher);
@@ -1016,7 +1014,7 @@
 			if( value instanceof LuanTable ) {
 				LuanTable v = (LuanTable)value;
 				if( !v.isList() )
-					sysLogger.error("not list");
+					logger.error("not list");
 				entry.setValue(v.asList());
 			}
 		}