Skip to content

Add seconds to log timestamps to avoid log name clashes. #2280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions compiler/test/dotty/tools/dotc/reporting/TestReporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ object TestReporter {
private[this] var logWriter: PrintWriter = _

private[this] def initLog() = if (logWriter eq null) {
val df = new SimpleDateFormat("yyyy-MM-dd-HH:mm")
val timestamp = df.format(new Date)
new JFile("../testlogs").mkdirs()
outFile = new JFile(s"../testlogs/tests-$timestamp.log")
val date = new Date
val df0 = new SimpleDateFormat("yyyy-MM-dd")
val df1 = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss")
val folder = s"../testlogs/tests-${df0.format(date)}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • if tests run in parallel, you can have two tests that start at the same second.
  • I would prefer to have names of the log-files that are predictable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended as a quick fix. There are many possible improvements that should be done on these logs.

new JFile(folder).mkdirs()
outFile = new JFile(s"$folder/tests-${df1.format(date)}.log")
logWriter = new PrintWriter(new FileOutputStream(outFile, true))
}

Expand Down