You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2025/11/20 06:33:26 UTC

[PR] log4j Filters [spark]

LuciferYang opened a new pull request, #53139:
URL: https://github.com/apache/spark/pull/53139

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'common/utils/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as new features, bug fixes, or other behavior changes. Documentation-only updates are not considered user-facing changes.
   
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   <!--
   If generative AI tooling has been used in the process of authoring this patch, please include the
   phrase: 'Generated-by: ' followed by the name of the tool and its version.
   If no, write 'No'.
   Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
   -->
   


-- 
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


Re: [PR] log4j Filters [spark]

Posted by "holdenk (via GitHub)" <gi...@apache.org>.
holdenk commented on PR #53139:
URL: https://github.com/apache/spark/pull/53139#issuecomment-3559378784

   Hi @LuciferYang can you follow the instructions at https://spark.apache.org/contributing.html :) Thanks for working on improving the logging :)


-- 
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


Re: [PR] [SPARK-54445][SQL][TESTS] Fix configuration related to `ThresholdFilter` in `log4j2.properties` within `hive-thriftserver` module [spark]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #53139:
URL: https://github.com/apache/spark/pull/53139#discussion_r2548645978


##########
sql/hive-thriftserver/src/test/resources/log4j2.properties:
##########
@@ -39,10 +37,8 @@ appender.file.fileName = target/unit-tests.log
 appender.file.layout.type = PatternLayout
 appender.file.layout.pattern = %d{HH:mm:ss.SSS} %t %p %c{1}: %m%n%ex
 
-appender.file.filter.1.type = Filters
-
-appender.file.filter.1.a.type = ThresholdFilter
-appender.file.filter.1.a.level = debug
+appender.file.filter.1.type = ThresholdFilter
+appender.file.filter.1.level = debug

Review Comment:
   The filter naming uses numeric identifiers (`filter.1`) while other log4j2.properties files in the codebase use descriptive names (`filter.threshold`). For consistency with `sql/core/src/test/resources/log4j2.properties` and `sql/hive/src/test/resources/log4j2.properties`, consider using:
   ```
   appender.file.filter.threshold.type = ThresholdFilter
   appender.file.filter.threshold.level = debug
   ```
   ```suggestion
   appender.file.filter.threshold.type = ThresholdFilter
   appender.file.filter.threshold.level = debug
   ```



##########
sql/hive-thriftserver/src/test/resources/log4j2.properties:
##########
@@ -27,10 +27,8 @@ appender.console.target = SYSTEM_OUT
 appender.console.layout.type = PatternLayout
 appender.console.layout.pattern = %d{HH:mm:ss.SSS} %p %c: %maxLen{%m}{512}%n%ex{8}%n
 
-appender.console.filter.1.type = Filters
-
-appender.console.filter.1.a.type = ThresholdFilter
-appender.console.filter.1.a.level = warn
+appender.console.filter.1.type = ThresholdFilter
+appender.console.filter.1.level = warn

Review Comment:
   The filter naming uses numeric identifiers (`filter.1`) while other log4j2.properties files in the codebase use descriptive names (`filter.threshold`). For consistency with `sql/core/src/test/resources/log4j2.properties` and `sql/hive/src/test/resources/log4j2.properties`, consider using:
   ```
   appender.console.filter.threshold.type = ThresholdFilter
   appender.console.filter.threshold.level = warn
   ```
   and similarly for the file appender:
   ```
   appender.file.filter.threshold.type = ThresholdFilter
   appender.file.filter.threshold.level = debug
   ```



-- 
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


Re: [PR] log4j Filters [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on code in PR #53139:
URL: https://github.com/apache/spark/pull/53139#discussion_r2544530569


##########
sql/hive-thriftserver/src/test/resources/log4j2.properties:
##########
@@ -27,10 +27,8 @@ appender.console.target = SYSTEM_OUT
 appender.console.layout.type = PatternLayout
 appender.console.layout.pattern = %d{HH:mm:ss.SSS} %p %c: %maxLen{%m}{512}%n%ex{8}%n
 
-appender.console.filter.1.type = Filters
-
-appender.console.filter.1.a.type = ThresholdFilter
-appender.console.filter.1.a.level = warn
+appender.console.filter.1.type = ThresholdFilter

Review Comment:
   To avoid 
   
   ```
   2025-11-20T05:56:22.1186895Z 2025-11-20T05:56:22.115648760Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-20T05:56:22.1317678Z 2025-11-20T05:56:22.130070007Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   ```



-- 
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


Re: [PR] [SPARK-54445][SQL][TESTS] Fix configuration related to `ThresholdFilter` in `log4j2.properties` within `hive-thriftserver` module [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on code in PR #53139:
URL: https://github.com/apache/spark/pull/53139#discussion_r2548761180


##########
sql/hive-thriftserver/src/test/resources/log4j2.properties:
##########
@@ -27,10 +27,8 @@ appender.console.target = SYSTEM_OUT
 appender.console.layout.type = PatternLayout
 appender.console.layout.pattern = %d{HH:mm:ss.SSS} %p %c: %maxLen{%m}{512}%n%ex{8}%n
 
-appender.console.filter.1.type = Filters
-
-appender.console.filter.1.a.type = ThresholdFilter
-appender.console.filter.1.a.level = warn
+appender.console.filter.1.type = ThresholdFilter
+appender.console.filter.1.level = warn

Review Comment:
   I attempted to modify it to
   
   ```
   diff --git a/sql/hive-thriftserver/src/test/resources/log4j2.properties b/sql/hive-thriftserver/src/test/resources/log4j2.properties
   index 3ad0c902283..db61ac18aee 100644
   --- a/sql/hive-thriftserver/src/test/resources/log4j2.properties
   +++ b/sql/hive-thriftserver/src/test/resources/log4j2.properties
   @@ -29,8 +29,8 @@ appender.console.layout.pattern = %d{HH:mm:ss.SSS} %p %c: %maxLen{%m}{512}%n%ex{
    
    appender.console.filter.1.type = Filters
    
   -appender.console.filter.1.a.type = ThresholdFilter
   -appender.console.filter.1.a.level = warn
   +appender.console.filter.threshold.type = ThresholdFilter
   +appender.console.filter.threshold.level = warn
    
    #File Appender
    appender.file.type = File
   @@ -41,8 +41,8 @@ appender.file.layout.pattern = %d{HH:mm:ss.SSS} %t %p %c{1}: %m%n%ex
    
    appender.file.filter.1.type = Filters
    
   -appender.file.filter.1.a.type = ThresholdFilter
   -appender.file.filter.1.a.level = debug
   +appender.file.filter.threshold.type = ThresholdFilter
   +appender.file.filter.threshold.level = debug
   ```
   
   then run `build/sbt -Phive -Phive-thriftserver "hive-thriftserver/test"`
   
   ```
   [warn] note: a setting might still be used by a command; to exclude a key from this `lintUnused` check
   [warn] either append it to `Global / excludeLintKeys` or call .withRank(KeyRanks.Invisible) on the key
   [warn] multiple main classes detected: run 'show discoveredMainClasses' to see the list
   [warn] multiple main classes detected: run 'show discoveredMainClasses' to see the list
   WARNING: Using incubator modules: jdk.incubator.vector
   WARNING: Using incubator modules: jdk.incubator.vector
   WARNING: Using incubator modules: jdk.incubator.vector
   WARNING: Using incubator modules: jdk.incubator.vector
   2025-11-21T07:04:45.182733Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.316967Z pool-1-thread-1 ERROR appender Console has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.323364Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.325055Z pool-1-thread-1 ERROR appender File has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.349702Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.484934Z pool-1-thread-1 ERROR appender Console has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.491476Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.503621Z pool-1-thread-1 ERROR appender File has no parameter that matches element ThresholdFilter
   [info] SparkSQLEnvSuite:
   2025-11-21T07:04:45.661128Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.686623Z pool-1-thread-1 ERROR appender Console has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.717872Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.746474Z pool-1-thread-1 ERROR appender Console has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.754913Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.820345Z pool-1-thread-1 ERROR appender File has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.821849Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.830148Z pool-1-thread-1 ERROR appender File has no parameter that matches element ThresholdFilter
   ```
   
   It seems the goal hasn't been achieved. What's your opinion on this? @yaooqinn 
   



-- 
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


Re: [PR] [SPARK-54445][SQL][TESTS] Fix configuration related to `ThresholdFilter` in `log4j2.properties` within `hive-thriftserver` module [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang closed pull request #53139: [SPARK-54445][SQL][TESTS] Fix configuration related to `ThresholdFilter` in `log4j2.properties` within `hive-thriftserver` module
URL: https://github.com/apache/spark/pull/53139


-- 
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


Re: [PR] [SPARK-54445][SQL][TESTS] Fix configuration related to `ThresholdFilter` in `log4j2.properties` within `hive-thriftserver` module [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on code in PR #53139:
URL: https://github.com/apache/spark/pull/53139#discussion_r2548761180


##########
sql/hive-thriftserver/src/test/resources/log4j2.properties:
##########
@@ -27,10 +27,8 @@ appender.console.target = SYSTEM_OUT
 appender.console.layout.type = PatternLayout
 appender.console.layout.pattern = %d{HH:mm:ss.SSS} %p %c: %maxLen{%m}{512}%n%ex{8}%n
 
-appender.console.filter.1.type = Filters
-
-appender.console.filter.1.a.type = ThresholdFilter
-appender.console.filter.1.a.level = warn
+appender.console.filter.1.type = ThresholdFilter
+appender.console.filter.1.level = warn

Review Comment:
   I attempted to modify it to
   
   ```
   diff --git a/sql/hive-thriftserver/src/test/resources/log4j2.properties b/sql/hive-thriftserver/src/test/resources/log4j2.properties
   index 3ad0c902283..db61ac18aee 100644
   --- a/sql/hive-thriftserver/src/test/resources/log4j2.properties
   +++ b/sql/hive-thriftserver/src/test/resources/log4j2.properties
   @@ -29,8 +29,8 @@ appender.console.layout.pattern = %d{HH:mm:ss.SSS} %p %c: %maxLen{%m}{512}%n%ex{
    
    appender.console.filter.1.type = Filters
    
   -appender.console.filter.1.a.type = ThresholdFilter
   -appender.console.filter.1.a.level = warn
   +appender.console.filter.threshold.type = ThresholdFilter
   +appender.console.filter.threshold.level = warn
    
    #File Appender
    appender.file.type = File
   @@ -41,8 +41,8 @@ appender.file.layout.pattern = %d{HH:mm:ss.SSS} %t %p %c{1}: %m%n%ex
    
    appender.file.filter.1.type = Filters
    
   -appender.file.filter.1.a.type = ThresholdFilter
   -appender.file.filter.1.a.level = debug
   +appender.file.filter.threshold.type = ThresholdFilter
   +appender.file.filter.threshold.level = debug
   ```
   
   then run `build/sbt -Phive -Phive-thriftserver "hive-thriftserver/test"`
   
   ```
   [warn] note: a setting might still be used by a command; to exclude a key from this `lintUnused` check
   [warn] either append it to `Global / excludeLintKeys` or call .withRank(KeyRanks.Invisible) on the key
   [warn] multiple main classes detected: run 'show discoveredMainClasses' to see the list
   [warn] multiple main classes detected: run 'show discoveredMainClasses' to see the list
   WARNING: Using incubator modules: jdk.incubator.vector
   WARNING: Using incubator modules: jdk.incubator.vector
   WARNING: Using incubator modules: jdk.incubator.vector
   WARNING: Using incubator modules: jdk.incubator.vector
   2025-11-21T07:04:45.182733Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.316967Z pool-1-thread-1 ERROR appender Console has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.323364Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.325055Z pool-1-thread-1 ERROR appender File has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.349702Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.484934Z pool-1-thread-1 ERROR appender Console has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.491476Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.503621Z pool-1-thread-1 ERROR appender File has no parameter that matches element ThresholdFilter
   [info] SparkSQLEnvSuite:
   2025-11-21T07:04:45.661128Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.686623Z pool-1-thread-1 ERROR appender Console has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.717872Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.746474Z pool-1-thread-1 ERROR appender Console has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.754913Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.820345Z pool-1-thread-1 ERROR appender File has no parameter that matches element ThresholdFilter
   2025-11-21T07:04:45.821849Z pool-1-thread-1 ERROR Filters contains invalid attributes "onMatch", "onMismatch"
   2025-11-21T07:04:45.830148Z pool-1-thread-1 ERROR appender File has no parameter that matches element ThresholdFilter
   ```
   
   It seems the goal hasn't been achieved. What's your opinion on this? @yaooqinn 
   



-- 
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


Re: [PR] [SPARK-54445][SQL][TESTS] Fix configuration related to `ThresholdFilter` in `log4j2.properties` within `hive-thriftserver` module [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #53139:
URL: https://github.com/apache/spark/pull/53139#issuecomment-3562390096

   Merged into master. Thanks @yaooqinn and @holdenk 


-- 
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