Skip to content

[SPARK-48124][CORE] Disable structured logging for Interpreters by default#46383

Closed
gengliangwang wants to merge 4 commits intoapache:masterfrom
gengliangwang:disableStructuredLogInRepl
Closed

[SPARK-48124][CORE] Disable structured logging for Interpreters by default#46383
gengliangwang wants to merge 4 commits intoapache:masterfrom
gengliangwang:disableStructuredLogInRepl

Conversation

@gengliangwang
Copy link
Member

What changes were proposed in this pull request?

For interpreters, structured logging should be disabled by default to avoid generating mixed plain text and structured logs on the same console.

spark-shell output with mixed plain text and structured logs:

Using Scala version 2.13.13 (OpenJDK 64-Bit Server VM, Java 17.0.9)

Type in expressions to have them evaluated.

Type :help for more information.

{"ts":"2024-05-04T01:11:03.797Z","level":"WARN","msg":"Unable to load native-hadoop library for your platform... using builtin-java classes where applicable","logger":"NativeCodeLoader"} {"ts":"2024-05-04T01:11:04.104Z","level":"WARN","msg":"Service 'SparkUI' could not bind on port 4040. Attempting port 4041.","logger":"Utils"}
Spark context Web UI available at http://10.10.114.155:4041/

Spark context available as 'sc' (master = local[*], app id = local-1714785064155).

Spark session available as 'spark'.

After changes, all the output are plain text:

Type :help for more information.

24/05/03 18:11:35 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

24/05/03 18:11:35 WARN Utils: Service 'SparkUI' could not bind on port 4040. Attempting port 4041.

Spark context Web UI available at http://10.10.114.155:4041/

Spark context available as 'sc' (master = local[*], app id = local-1714785095892).

Spark session available as 'spark'.

Note that submitting a spark application using spark-submit will still generates structured logs.

Why are the changes needed?

To avoid tgenerating mixed plain text and structured logs on the same console when using the Interpreters.

Does this PR introduce any user-facing change?

No, this reverts to the behavior of Spark 3.5

How was this patch tested?

Manual test

Was this patch authored or co-authored using generative AI tooling?

No


- Since Spark 4.0, Spark uses the external shuffle service for deleting shuffle blocks for deallocated executors when the shuffle is no longer needed. To restore the legacy behavior, you can set `spark.shuffle.service.removeShuffle` to `false`.

- Since Spark 4.0, the default log4j output has shifted from plain text to JSON lines to enhance analyzability. To revert to plain text output, you can either set `spark.log.structuredLogging.enabled` to `false`, or use a custom log4j configuration.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: the flag spark.log.structuredLogging.enabled is not taking effect as expected. I created https://issues.apache.org/jira/browse/SPARK-48126 as a follow-up. Let's not mention it in the Spark 4.0 preview release.

@HyukjinKwon HyukjinKwon changed the title [SPARK-48124][Core] Disable structured logging for Interpreters by default [SPARK-48124][CORE] Disable structured logging for Interpreters by default May 4, 2024
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Thank you, @gengliangwang .

@dongjoon-hyun
Copy link
Member

Merged to master for Apache Spark 4.0.0-preview.

@gengliangwang
Copy link
Member Author

Thank you, @dongjoon-hyun !

gengliangwang pushed a commit that referenced this pull request May 5, 2024
…fault

### What changes were proposed in this pull request?
The pr is followup #46383, to `disable` structured logging for` Connect-Repl` by default.

### Why are the changes needed?
Before:
<img width="1397" alt="image" src="https://github.com/apache/spark/assets/15246973/10d93a09-f098-4653-9e95-571481dd03e9">

After:
<img width="1406" alt="image" src="https://github.com/apache/spark/assets/15246973/e3354359-d6bc-4b2c-801b-8a2c3697f78e">

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Manually test.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes #46387 from panbingkun/SPARK-48124_FOLLOWUP.

Authored-by: panbingkun <panbingkun@baidu.com>
Signed-off-by: Gengliang Wang <gengliang@apache.org>
sinaiamonkar-sai pushed a commit to sinaiamonkar-sai/spark that referenced this pull request May 5, 2024
…fault

### What changes were proposed in this pull request?

For interpreters, structured logging should be disabled by default to avoid generating mixed plain text and structured logs on the same console.

spark-shell output with mixed plain text and structured logs:
```
Using Scala version 2.13.13 (OpenJDK 64-Bit Server VM, Java 17.0.9)

Type in expressions to have them evaluated.

Type :help for more information.

{"ts":"2024-05-04T01:11:03.797Z","level":"WARN","msg":"Unable to load native-hadoop library for your platform... using builtin-java classes where applicable","logger":"NativeCodeLoader"} {"ts":"2024-05-04T01:11:04.104Z","level":"WARN","msg":"Service 'SparkUI' could not bind on port 4040. Attempting port 4041.","logger":"Utils"}
Spark context Web UI available at http://10.10.114.155:4041/

Spark context available as 'sc' (master = local[*], app id = local-1714785064155).

Spark session available as 'spark'.
```

After changes, all the output are plain text:
```
Type :help for more information.

24/05/03 18:11:35 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

24/05/03 18:11:35 WARN Utils: Service 'SparkUI' could not bind on port 4040. Attempting port 4041.

Spark context Web UI available at http://10.10.114.155:4041/

Spark context available as 'sc' (master = local[*], app id = local-1714785095892).

Spark session available as 'spark'.
```

Note that submitting a spark application using `spark-submit` will still generates structured logs.
### Why are the changes needed?

To avoid tgenerating mixed plain text and structured logs on the same console when using the Interpreters.

### Does this PR introduce _any_ user-facing change?

No, this reverts to the behavior of Spark 3.5

### How was this patch tested?

Manual test

### Was this patch authored or co-authored using generative AI tooling?

No

Closes apache#46383 from gengliangwang/disableStructuredLogInRepl.

Authored-by: Gengliang Wang <gengliang@apache.org>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
sinaiamonkar-sai pushed a commit to sinaiamonkar-sai/spark that referenced this pull request May 5, 2024
…fault

### What changes were proposed in this pull request?
The pr is followup apache#46383, to `disable` structured logging for` Connect-Repl` by default.

### Why are the changes needed?
Before:
<img width="1397" alt="image" src="https://github.com/apache/spark/assets/15246973/10d93a09-f098-4653-9e95-571481dd03e9">

After:
<img width="1406" alt="image" src="https://github.com/apache/spark/assets/15246973/e3354359-d6bc-4b2c-801b-8a2c3697f78e">

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Manually test.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#46387 from panbingkun/SPARK-48124_FOLLOWUP.

Authored-by: panbingkun <panbingkun@baidu.com>
Signed-off-by: Gengliang Wang <gengliang@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants