Skip to content

Apache Lucene open-source search software

LUCENE-6564: Add milliseconds to timestamp in IW output for tests

Ramkumar Aiyengare2a1ee29e0a8
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 4eaf785e13b..2bcc7309035 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -148,6 +148,9 @@ Build
* LUCENE-6518: Don't report false thread leaks from IBM J9
ClassCache Reaper in test framework. (Dawid Weiss)
+* LUCENE-6564: Add milliseconds to timestamp in InfoStream output for tests
+ (Ramkumar Aiyengar)
+
======================= Lucene 5.2.1 =======================
Bug Fixes
diff --git a/lucene/core/src/java/org/apache/lucene/util/PrintStreamInfoStream.java b/lucene/core/src/java/org/apache/lucene/util/PrintStreamInfoStream.java
index cc03d43c8ff..c3fd897d20b 100644
--- a/lucene/core/src/java/org/apache/lucene/util/PrintStreamInfoStream.java
+++ b/lucene/core/src/java/org/apache/lucene/util/PrintStreamInfoStream.java
@@ -36,7 +36,7 @@ public class PrintStreamInfoStream extends InfoStream {
private static final AtomicInteger MESSAGE_ID = new AtomicInteger();
protected final int messageID;
- private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ROOT);
+ protected static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ROOT);
protected final PrintStream stream;
diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java b/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
index 03f5afbd1f2..c96a59231ba 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
@@ -23,7 +23,6 @@ import java.util.Date;
import java.util.HashSet;
import java.util.Locale;
import java.util.Random;
-import java.util.Set;
import java.util.TimeZone;
import org.apache.lucene.codecs.Codec;
@@ -99,7 +98,7 @@ final class TestRuleSetupAndRestoreClassEnv extends AbstractBeforeAfterRule {
} else {
name = Thread.currentThread().getName();
}
- stream.println(component + " " + messageID + " [" + new Date() + "; " + name + "]: " + message);
+ stream.println(component + " " + messageID + " [" + dateFormat.format(new Date()) + "; " + name + "]: " + message);
}
}