Skip to content

Commit b2b8f81

Browse files
committed
improve logging for isStrictlyNewerThanDocument()
1 parent 4ba3aef commit b2b8f81

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,21 +893,27 @@ private static boolean isStrictlyNewerThanDocument(File file) {
893893
try {
894894
Document doc = IndexDatabase.getDocument(file);
895895
if (Objects.isNull(doc)) {
896+
LOGGER.log(Level.WARNING, "cannot get document for ''{0}''", file);
896897
return true;
897898
}
898899
IndexableField field = doc.getField(QueryBuilder.DATE);
899900
try {
900901
Date docDate = DateTools.stringToDate(field.stringValue());
901902
// Assumes millisecond precision.
902903
long lastModified = file.lastModified();
904+
if (LOGGER.isLoggable(Level.FINE)) {
905+
LOGGER.log(Level.FINEST, String.format("checking date for '%s': %d %d",
906+
file, lastModified, docDate.getTime()));
907+
}
903908
if (lastModified <= docDate.getTime()) {
904909
return false;
905910
}
906911
} catch (java.text.ParseException e) {
912+
LOGGER.log(Level.WARNING, String.format("cannot convert date for '%s'", file), e);
907913
return true;
908914
}
909915
} catch (ParseException | IOException e) {
910-
LOGGER.log(Level.FINEST, "cannot get document for ''{0}''", file);
916+
LOGGER.log(Level.WARNING, String.format("cannot get document for '%s'", file), e);
911917
}
912918

913919
return true;

0 commit comments

Comments
 (0)