You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ya...@apache.org on 2020/08/07 02:34:28 UTC
[spark] branch branch-3.0 updated: [SPARK-32538][CORE][TEST] Use
local time zone for the timestamp logged in unit-tests.log
This is an automated email from the ASF dual-hosted git repository.
yamamuro pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new c7af0be [SPARK-32538][CORE][TEST] Use local time zone for the timestamp logged in unit-tests.log
c7af0be is described below
commit c7af0be530d8c2a4935acf9a593034fb85d5572f
Author: Kousuke Saruta <sa...@oss.nttdata.com>
AuthorDate: Fri Aug 7 11:29:18 2020 +0900
[SPARK-32538][CORE][TEST] Use local time zone for the timestamp logged 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 <sa...@oss.nttdata.com>
Signed-off-by: Takeshi Yamamuro <ya...@apache.org>
(cherry picked from commit 4e267f3eb9ca0df18647c859b75b61b1af800120)
Signed-off-by: Takeshi Yamamuro <ya...@apache.org>
---
core/src/test/scala/org/apache/spark/SparkFunSuite.scala | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/core/src/test/scala/org/apache/spark/SparkFunSuite.scala b/core/src/test/scala/org/apache/spark/SparkFunSuite.scala
index ec641f8..d402074 100644
--- a/core/src/test/scala/org/apache/spark/SparkFunSuite.scala
+++ b/core/src/test/scala/org/apache/spark/SparkFunSuite.scala
@@ -64,6 +64,12 @@ abstract class SparkFunSuite
with Logging {
// scalastyle:on
+ // Initialize the logger forcibly to let the logger log timestamp
+ // 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
+
// Timezone is fixed to America/Los_Angeles for those timezone sensitive tests (timestamp_*)
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"))
// Add Locale setting
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org