-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-51274][PYTHON] PySparkLogger should respect the expected keywo…
…rd arguments ### What changes were proposed in this pull request? `PySparkLogger` should respect the expected keyword arguments. Also, `debug`, `warn`, `critical`, `fatal`, and `log` are added to have proper docs. ### Why are the changes needed? Currently all of keyword arguments for `PySparkLogger` will be in the `context`, but it should respect the expected keyword arguments, like `exc_info`, `stack_info`, etc. ### Does this PR introduce _any_ user-facing change? Yes, the logging methods for `PySparkLogger` will respect the expected arguments. - before: ```py >>> from pyspark.logger.logger import PySparkLogger >>> logger = PySparkLogger.getLogger("TestLogger") >>> >>> logger.warning("This is an info log", exc_info=True, user="test_user_info", action="test_action_info") {"ts": "2025-02-21 10:46:53,786", "level": "WARNING", "logger": "TestLogger", "msg": "This is an info log", "context": {"exc_info": true, "user": "test_user_info", "action": "test_action_info"}} ``` - after ```py >>> logger.warning("This is an info log", exc_info=True, user="test_user_info", action="test_action_info") {"ts": "2025-02-21 10:47:36,351", "level": "WARNING", "logger": "TestLogger", "msg": "This is an info log", "context": {"user": "test_user_info", "action": "test_action_info"}, "exception": {"class": "UnknownException", "msg": "None", "stacktrace": ["NoneType: None"]}} ``` ### How was this patch tested? Added the related tests. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #50032 from ueshin/issues/SPARK-51274/logger. Authored-by: Takuya Ueshin <ueshin@databricks.com> Signed-off-by: Takuya Ueshin <ueshin@databricks.com> (cherry picked from commit eb4a28b) Signed-off-by: Takuya Ueshin <ueshin@databricks.com>
- Loading branch information
Showing
3 changed files
with
123 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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