You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cdkrot (via GitHub)" <gi...@apache.org> on 2023/07/27 09:43:16 UTC

[GitHub] [spark] cdkrot commented on a diff in pull request #42175: [SPARK-44558][CONNECT][PYTHON] Export Spark Log Level

cdkrot commented on code in PR #42175:
URL: https://github.com/apache/spark/pull/42175#discussion_r1276026310


##########
python/pyspark/sql/connect/client/core.py:
##########
@@ -114,6 +115,19 @@ def _configure_logging() -> logging.Logger:
 logger = _configure_logging()
 
 
+def spark_connect_log_level() -> Optional[int]:
+    """
+    This returns this log level as integer, or none (if no logging is enabled).
+
+    Spark Connect logging can be configured with environment variable 'SPARK_CONNECT_LOG_LEVEL'
+    .. versionadded:: 3.5.0
+    """
+
+    if logger.disabled:
+        return None
+    return logger.level

Review Comment:
   Need return statement for codestyle:
   
   ```
   annotations failed mypy checks:
   python/pyspark/sql/connect/client/core.py:118: error: Missing return statement  [return]
   
   ```



##########
python/pyspark/sql/connect/client/core.py:
##########
@@ -104,7 +105,7 @@ def _configure_logging() -> logging.Logger:
 
     # Check the environment variables for log levels:
     if "SPARK_CONNECT_LOG_LEVEL" in os.environ:
-        logger.setLevel(os.getenv("SPARK_CONNECT_LOG_LEVEL", "error").upper())

Review Comment:
   Note original version has a typo, the default value is never used due to above 'if'. I'm just removing the typo without changing the logic



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org