SPRKPY1047
pyspark.context.SparkContext.setLogLevel
This issue code has been deprecated since Spark Conversion Core Version 4.6.0
Description
This issue appears when the tool detects the usage of pyspark.context.SparkContext.setLogLevel which has a workaround.
Scenario
Input
Below is an example of the usage of the method setLogLevel
.
Output
The tool adds the EWI SPRKPY1047
indicating that a workaround can be implemented.
Recommended fix
Replace the setLogLevel
function usage with logging.basicConfig
that provides a set of convenience functions for simple logging usage. In order to use it, we need to import two modules, "logging" and "sys", and the level constant should be replaced using the "Level equivalent table":
Level equivalent table
"ALL"
This has no equivalent
"DEBUG"
logging.DEBUG
"ERROR"
logging.ERROR
"FATAL"
logging.CRITICAL
"INFO"
logging.INFO
"OFF"
logging.NOTSET
"TRACE"
This has no equivalent
"WARN"
logging.WARNING
Additional recommendations
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
Last updated