Skip to content

Conversation

@sarutak
Copy link
Member

@sarutak sarutak commented Aug 5, 2020

What changes were proposed in this pull request?

This PR lets the logger log timestamp based on local time zone during test.
SparkFunSuite fixes the default time zone to America/Los_Angeles so the timestamp logged in unit-tests.log is also based on the fixed time zone.

Why are the changes needed?

It's confusable for developers whose time zone is not America/Los_Angeles.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Run existing tests and confirmed uint-tests.log.
If your local time zone is America/Los_Angeles, you can test by setting the environment variable TZ like as follows.

$ TZ=Asia/Tokyo build/sbt "testOnly org.apache.spark.executor.ExecutorSuite"
$ tail core/target/unit-tests.log

@SparkQA
Copy link

SparkQA commented Aug 5, 2020

Test build #127090 has finished for PR 29356 at commit 8001893.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

// based on the local time zone depending on environments.
// The default time zone will be set to America/Los_Angeles later
// so this initialization is necessary here.
log
Copy link
Member

Choose a reason for hiding this comment

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

hm, TimeZone.setDefault below doesn't an affect the already-instanciated logger?

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems so. DateFormat classes used in log4j uses Calendar, which is instantiated in the constructor with the default time zone at the time.

Copy link
Member

Choose a reason for hiding this comment

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

okay, if so, the change looks reasonable. cc: @srowen

@maropu maropu changed the title [SPARK-32538][TEST] Use local time zone for the timestamp logged in unit-tests.log [SPARK-32538][CORE][TEST] Use local time zone for the timestamp logged in unit-tests.log Aug 6, 2020
@maropu maropu closed this in 4e267f3 Aug 7, 2020
maropu pushed a commit that referenced this pull request Aug 7, 2020
…d in unit-tests.log

### What changes were proposed in this pull request?

This PR lets the logger log timestamp based on local time zone during test.
`SparkFunSuite` fixes the default time zone to America/Los_Angeles so the timestamp logged in unit-tests.log is also based on the fixed time zone.

### Why are the changes needed?

It's confusable for developers whose time zone is not America/Los_Angeles.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Run existing tests and confirmed uint-tests.log.
If your local time zone is America/Los_Angeles, you can test by setting the environment variable `TZ` like as follows.
```
$ TZ=Asia/Tokyo build/sbt "testOnly org.apache.spark.executor.ExecutorSuite"
$ tail core/target/unit-tests.log
```

Closes #29356 from sarutak/fix-unit-test-log-timezone.

Authored-by: Kousuke Saruta <[email protected]>
Signed-off-by: Takeshi Yamamuro <[email protected]>
(cherry picked from commit 4e267f3)
Signed-off-by: Takeshi Yamamuro <[email protected]>
@maropu
Copy link
Member

maropu commented Aug 7, 2020

Thanks! Merged to master/branch-3.0. (NOTE: I manually checked this change could fix the issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants