How to enable Apache Spark logging for the code running on the localhost?

To see Apache Spark logs, you need to set the log level before running the transformations. The following snippet will enable trace logs to the console:

spark_session.sparkContext.setLogLevel('TRACE')