Reputation: 3522
I've noticed in the RuleExecutor in spark performs a trace log each time that catalyst alters the plan:
What I'm wondering is how do I configure spark so that trace logging is turned on? I'm using log4j and have come across the following documentation: https://jaceklaskowski.gitbooks.io/mastering-apache-spark/spark-logging.html
I've been digging around the code for a while, and I've seen that you can set 'log4j.threshold=TRACE' to have part of the logger be in trace mode, however I cannot seem to get the logger used by catalyst to pick up the setting.
What am I doing wrong?
Upvotes: 1
Views: 2500
Reputation: 2014
I just tried a simple structured streaming program reading data from Kafka in IntelliJ and the following statement worked for me i.e. gave me trace level logs:
SparkSession.builder().getOrCreate().sparkContext().setLogLevel("TRACE");
Here's a portion of the output displaying some of the trace logs:
...
...
18/10/12 23:56:02 TRACE package$ExpressionCanonicalizer: Fixed point reached for batch CleanExpressions after 1 iterations.
18/10/12 23:56:02 TRACE package$ExpressionCanonicalizer: Batch CleanExpressions has no effect.
18/10/12 23:56:02 TRACE package$ExpressionCanonicalizer: Fixed point reached for batch CleanExpressions after 1 iterations.
18/10/12 23:56:02 TRACE package$ExpressionCanonicalizer: Batch CleanExpressions has no effect.
18/10/12 23:56:02 TRACE package$ExpressionCanonicalizer: Fixed point reached for batch CleanExpressions after 1 iterations.
18/10/12 23:56:02 TRACE package$ExpressionCanonicalizer: Batch CleanExpressions has no effect.
18/10/12 23:56:02 TRACE package$ExpressionCanonicalizer: Fixed point reached for batch CleanExpressions after 1 iterations.
18/10/12 23:56:02 TRACE package$ExpressionCanonicalizer: Batch CleanExpressions has no effect.
+-----+----+-----+-----------------------+
|topic|key |value|timestamp |
+-----+----+-----+-----------------------+
|test |null|hi345|2018-10-12 23:56:00.099|
+-----+----+-----+-----------------------+
18/10/12 23:56:02 DEBUG GenerateUnsafeProjection: code for input[0, string, true],input[1, string, true],input[2, string, true],input[3, string, true]:
/* 001 */ public java.lang.Object generate(Object[] references) {
/* 002 */ return new SpecificUnsafeProjection(references);
/* 003 */ }
/* 004 */
/* 005 */ class SpecificUnsafeProjection extends org.apache.spark.sql.catalyst.expressions.UnsafeProjection {
/* 006 */
/* 007 */ private Object[] references;
...
...
Hope this helps!
Upvotes: 1