-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-51278][PYTHON] Use appropriate structure of JSON format for PySparkLogger
#50038
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ueshin
approved these changes
Feb 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, LGTM, pending tests.
HyukjinKwon
approved these changes
Feb 23, 2025
Co-authored-by: Takuya UESHIN <ueshin@happy-camper.st>
…to fix_json_format
itholic
added a commit
that referenced
this pull request
Feb 24, 2025
…ySparkLogger` ### What changes were proposed in this pull request? This PR proposes to use appropriate structure of JSON format for `PySparkLogger` by updating `JSONFormatter`. ### Why are the changes needed? To align the log structure with JVM side. Currently the "stacktrace" does not align. ### Does this PR introduce _any_ user-facing change? The output JSON structure will include "stacktrace" in correct format: **Before** ```json { "ts": "2025-02-21 15:40:52,043", "level": "ERROR", "logger": "TestLogger", "msg": "Exception occurred", "context": {"user": "test_user_stacktrace"}, "exception": { "class": "ValueError", "msg": "Test Exception", "stacktrace": [ "Traceback (most recent call last):", " File \"/spark/python/pyspark/logger/tests/test_logger.py\", line 115, in test_log_exception_with_stacktrace", " raise ValueError(\"Test Exception\")", "ValueError: Test Exception" ] } } ``` **After** ```json { "ts": "2025-02-21 15:40:52,043", "level": "ERROR", "logger": "TestLogger", "msg": "Exception occurred", "context": {"user": "test_user_stacktrace"}, "exception": { "class": "ValueError", "msg": "Test Exception", "stacktrace": [ { "class": null, "method": "test_log_exception_with_stacktrace", "file": "/spark/python/pyspark/logger/tests/test_logger.py", "line": "115" } ] } } ``` ### How was this patch tested? Added related UT ### Was this patch authored or co-authored using generative AI tooling? No Closes #50038 from itholic/fix_json_format. Lead-authored-by: Haejoon Lee <haejoon.lee@databricks.com> Co-authored-by: Hyukjin Kwon <gurwls223@gmail.com> Signed-off-by: Haejoon Lee <haejoon.lee@databricks.com> (cherry picked from commit 67a337e) Signed-off-by: Haejoon Lee <haejoon.lee@databricks.com>
Merged to master and branch-4.0. |
HyukjinKwon
pushed a commit
that referenced
this pull request
Feb 28, 2025
### What changes were proposed in this pull request? This PR followups #50038 to update documentation following the fixed JSON format. ### Why are the changes needed? To match the docs with real logging format ### Does this PR introduce _any_ user-facing change? No API changes, but the user-facing documentation updated. ### How was this patch tested? CI ### Was this patch authored or co-authored using generative AI tooling? No. Closes #50100 from itholic/json_format_followup. Authored-by: Haejoon Lee <haejoon.lee@databricks.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
HyukjinKwon
pushed a commit
that referenced
this pull request
Feb 28, 2025
### What changes were proposed in this pull request? This PR followups #50038 to update documentation following the fixed JSON format. ### Why are the changes needed? To match the docs with real logging format ### Does this PR introduce _any_ user-facing change? No API changes, but the user-facing documentation updated. ### How was this patch tested? CI ### Was this patch authored or co-authored using generative AI tooling? No. Closes #50100 from itholic/json_format_followup. Authored-by: Haejoon Lee <haejoon.lee@databricks.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org> (cherry picked from commit b05f18b) Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Pajaraja
pushed a commit
to Pajaraja/spark
that referenced
this pull request
Mar 6, 2025
…ySparkLogger` ### What changes were proposed in this pull request? This PR proposes to use appropriate structure of JSON format for `PySparkLogger` by updating `JSONFormatter`. ### Why are the changes needed? To align the log structure with JVM side. Currently the "stacktrace" does not align. ### Does this PR introduce _any_ user-facing change? The output JSON structure will include "stacktrace" in correct format: **Before** ```json { "ts": "2025-02-21 15:40:52,043", "level": "ERROR", "logger": "TestLogger", "msg": "Exception occurred", "context": {"user": "test_user_stacktrace"}, "exception": { "class": "ValueError", "msg": "Test Exception", "stacktrace": [ "Traceback (most recent call last):", " File \"/spark/python/pyspark/logger/tests/test_logger.py\", line 115, in test_log_exception_with_stacktrace", " raise ValueError(\"Test Exception\")", "ValueError: Test Exception" ] } } ``` **After** ```json { "ts": "2025-02-21 15:40:52,043", "level": "ERROR", "logger": "TestLogger", "msg": "Exception occurred", "context": {"user": "test_user_stacktrace"}, "exception": { "class": "ValueError", "msg": "Test Exception", "stacktrace": [ { "class": null, "method": "test_log_exception_with_stacktrace", "file": "/spark/python/pyspark/logger/tests/test_logger.py", "line": "115" } ] } } ``` ### How was this patch tested? Added related UT ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#50038 from itholic/fix_json_format. Lead-authored-by: Haejoon Lee <haejoon.lee@databricks.com> Co-authored-by: Hyukjin Kwon <gurwls223@gmail.com> Signed-off-by: Haejoon Lee <haejoon.lee@databricks.com>
Pajaraja
pushed a commit
to Pajaraja/spark
that referenced
this pull request
Mar 6, 2025
### What changes were proposed in this pull request? This PR followups apache#50038 to update documentation following the fixed JSON format. ### Why are the changes needed? To match the docs with real logging format ### Does this PR introduce _any_ user-facing change? No API changes, but the user-facing documentation updated. ### How was this patch tested? CI ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#50100 from itholic/json_format_followup. Authored-by: Haejoon Lee <haejoon.lee@databricks.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR proposes to use appropriate structure of JSON format for
PySparkLogger
by updatingJSONFormatter
.Why are the changes needed?
To align the log structure with JVM side. Currently the "stacktrace" does not align.
Does this PR introduce any user-facing change?
The output JSON structure will include "stacktrace" in correct format:
Before
After
How was this patch tested?
Added related UT
Was this patch authored or co-authored using generative AI tooling?
No