diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java index 2c85ca2a340..8242fe20b44 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java @@ -893,6 +893,7 @@ private static boolean isStrictlyNewerThanDocument(File file) { try { Document doc = IndexDatabase.getDocument(file); if (Objects.isNull(doc)) { + LOGGER.log(Level.WARNING, "cannot get document for ''{0}''", file); return true; } IndexableField field = doc.getField(QueryBuilder.DATE); @@ -900,14 +901,19 @@ private static boolean isStrictlyNewerThanDocument(File file) { Date docDate = DateTools.stringToDate(field.stringValue()); // Assumes millisecond precision. long lastModified = file.lastModified(); + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINEST, String.format("checking date for '%s': %d %d", + file, lastModified, docDate.getTime())); + } if (lastModified <= docDate.getTime()) { return false; } } catch (java.text.ParseException e) { + LOGGER.log(Level.WARNING, String.format("cannot convert date for '%s'", file), e); return true; } } catch (ParseException | IOException e) { - LOGGER.log(Level.FINEST, "cannot get document for ''{0}''", file); + LOGGER.log(Level.WARNING, String.format("cannot get document for '%s'", file), e); } return true; @@ -2105,7 +2111,8 @@ public static Document getDocument(File file) throws ParseException, IOException try { Statistics stat = new Statistics(); TopDocs top = searcher.search(q, 1); - stat.report(LOGGER, Level.FINEST, String.format("search via getDocument(%s) done", file), + stat.report(LOGGER, Level.FINEST, + String.format("search via getDocument(%s) done (%d hits)", file, top.totalHits.value), "search.latency", new String[]{"category", "getdocument", "outcome", top.totalHits.value == 0 ? "empty" : "success"}); if (top.totalHits.value == 0) { @@ -2117,6 +2124,8 @@ public static Document getDocument(File file) throws ParseException, IOException // Only use the document if we found an exact match. if (!path.equals(foundPath)) { + LOGGER.log(Level.FINEST, "not matching path: ''{0}'' for ''{1}''", + new Object[]{foundPath, path}); return null; } } finally {