itholic opened a new pull request, #50038: URL: https://github.com/apache/spark/pull/50038
### 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": "ValueError", "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 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org