Skip to content

[SPARK-37853][CORE] Clean up deprecation compilation warning related to log4j2#35153

Closed
LuciferYang wants to merge 5 commits intoapache:masterfrom
LuciferYang:SPARK-37853
Closed

[SPARK-37853][CORE] Clean up deprecation compilation warning related to log4j2#35153
LuciferYang wants to merge 5 commits intoapache:masterfrom
LuciferYang:SPARK-37853

Conversation

@LuciferYang
Copy link
Copy Markdown
Contributor

@LuciferYang LuciferYang commented Jan 10, 2022

What changes were proposed in this pull request?

The are 2 deprecation compilation warning related to log4j2:

[WARNING] [Warn] /spark-source/core/src/main/scala/org/apache/spark/util/logging/DriverLogger.scala:64: [deprecation @ org.apache.spark.util.logging.DriverLogger.addLogAppender.fa | origin=org.apache.logging.log4j.core.appender.FileAppender.createAppender | version=] method createAppender in class FileAppender is deprecated
[WARNING] [Warn] /spark-source/core/src/test/scala/org/apache/spark/SparkFunSuite.scala:268: [deprecation @ org.apache.spark.SparkFunSuite.LogAppender.<init> | origin=org.apache.logging.log4j.core.appender.AbstractAppender.<init> | version=] constructor AbstractAppender in class AbstractAppender is deprecated

In order to fix the above compilation warning, the main change of this pr as follows:

  1. Log4jFileAppender.Builder is used instead of Log4jFileAppender.createAppender to fix compilation warning of DriverLogger, and the configuration of some default values is omitted refer to SPARK-6305.

The initial status of Log4jFileAppender.Builder as follows:

fileName = null
append = true
locking = false
advertise = false
advertiseUri = null
createOnDemand = false
filePermissions = null
fileOwner = null
fileGroup = null
bufferedIo = true
bufferSize = 8192
immediateFlush = true
ignoreExceptions = true
layout = null
name = null
configuration = null
filter = null
propertyArray = null

And we can't use the chained API invocation mode because AbstractFilterable.Builder.asBuilder() method will return Any in Scala.

  1. Use the recommended constructor of AbstractAppender refer to javadoc to fix compilation warning in SparkFunSuite.

Why are the changes needed?

Clean up deprecation compilation warning related to log4j2

Does this PR introduce any user-facing change?

No

How was this patch tested?

Pass GA

@github-actions github-actions Bot added the CORE label Jan 10, 2022
@LuciferYang LuciferYang changed the title [SPARK-37853][CORE][TEST] Clean up deprecation compilation warning related to log4j2 [SPARK-37853][CORE][TESTS] Clean up deprecation compilation warning related to log4j2 Jan 10, 2022
@dongjoon-hyun
Copy link
Copy Markdown
Member

cc @viirya

val fa = Log4jFileAppender.createAppender(localLogFile, "false", "false",
DriverLogger.APPENDER_NAME, "true", "false", "false", "4000", layout, null,
"false", null, config);
def log4jFileAppender() = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not a [TESTS], @LuciferYang .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your correction

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-37853][CORE][TESTS] Clean up deprecation compilation warning related to log4j2 [SPARK-37853][CORE] Clean up deprecation compilation warning related to log4j2 Jan 10, 2022
Copy link
Copy Markdown
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. Merged to master for Apache Spark 3.3.

dchvn pushed a commit to dchvn/spark that referenced this pull request Jan 19, 2022
…to log4j2

### What changes were proposed in this pull request?
The are 2 deprecation compilation warning related to log4j2:
```
[WARNING] [Warn] /spark-source/core/src/main/scala/org/apache/spark/util/logging/DriverLogger.scala:64: [deprecation  org.apache.spark.util.logging.DriverLogger.addLogAppender.fa | origin=org.apache.logging.log4j.core.appender.FileAppender.createAppender | version=] method createAppender in class FileAppender is deprecated
[WARNING] [Warn] /spark-source/core/src/test/scala/org/apache/spark/SparkFunSuite.scala:268: [deprecation  org.apache.spark.SparkFunSuite.LogAppender.<init> | origin=org.apache.logging.log4j.core.appender.AbstractAppender.<init> | version=] constructor AbstractAppender in class AbstractAppender is deprecated
```

In order to fix the above compilation warning, the main change of this pr as follows:
1.  `Log4jFileAppender.Builder` is used instead of `Log4jFileAppender.createAppender` to fix compilation warning of `DriverLogger`, and the configuration of some default values is omitted refer to SPARK-6305.

The initial status of `Log4jFileAppender.Builder` as follows:

```java
fileName = null
append = true
locking = false
advertise = false
advertiseUri = null
createOnDemand = false
filePermissions = null
fileOwner = null
fileGroup = null
bufferedIo = true
bufferSize = 8192
immediateFlush = true
ignoreExceptions = true
layout = null
name = null
configuration = null
filter = null
propertyArray = null
```

And we can't use the chained API invocation mode because `AbstractFilterable.Builder.asBuilder()` method will return `Any` in Scala.

2. Use the recommended constructor of `AbstractAppender` refer to javadoc to fix compilation warning  in `SparkFunSuite`.

### Why are the changes needed?
Clean up deprecation compilation warning related to log4j2

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

### How was this patch tested?
Pass GA

Closes apache#35153 from LuciferYang/SPARK-37853.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
kazuyukitanimura pushed a commit to kazuyukitanimura/spark that referenced this pull request Aug 10, 2022
…to log4j2

The are 2 deprecation compilation warning related to log4j2:
```
[WARNING] [Warn] /spark-source/core/src/main/scala/org/apache/spark/util/logging/DriverLogger.scala:64: [deprecation  org.apache.spark.util.logging.DriverLogger.addLogAppender.fa | origin=org.apache.logging.log4j.core.appender.FileAppender.createAppender | version=] method createAppender in class FileAppender is deprecated
[WARNING] [Warn] /spark-source/core/src/test/scala/org/apache/spark/SparkFunSuite.scala:268: [deprecation  org.apache.spark.SparkFunSuite.LogAppender.<init> | origin=org.apache.logging.log4j.core.appender.AbstractAppender.<init> | version=] constructor AbstractAppender in class AbstractAppender is deprecated
```

In order to fix the above compilation warning, the main change of this pr as follows:
1.  `Log4jFileAppender.Builder` is used instead of `Log4jFileAppender.createAppender` to fix compilation warning of `DriverLogger`, and the configuration of some default values is omitted refer to SPARK-6305.

The initial status of `Log4jFileAppender.Builder` as follows:

```java
fileName = null
append = true
locking = false
advertise = false
advertiseUri = null
createOnDemand = false
filePermissions = null
fileOwner = null
fileGroup = null
bufferedIo = true
bufferSize = 8192
immediateFlush = true
ignoreExceptions = true
layout = null
name = null
configuration = null
filter = null
propertyArray = null
```

And we can't use the chained API invocation mode because `AbstractFilterable.Builder.asBuilder()` method will return `Any` in Scala.

2. Use the recommended constructor of `AbstractAppender` refer to javadoc to fix compilation warning  in `SparkFunSuite`.

Clean up deprecation compilation warning related to log4j2

No

Pass GA

Closes apache#35153 from LuciferYang/SPARK-37853.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
asiunov pushed a commit to ascend-io/spark that referenced this pull request Aug 25, 2022
…to log4j2

### What changes were proposed in this pull request?
The are 2 deprecation compilation warning related to log4j2:
```
[WARNING] [Warn] /spark-source/core/src/main/scala/org/apache/spark/util/logging/DriverLogger.scala:64: [deprecation  org.apache.spark.util.logging.DriverLogger.addLogAppender.fa | origin=org.apache.logging.log4j.core.appender.FileAppender.createAppender | version=] method createAppender in class FileAppender is deprecated
[WARNING] [Warn] /spark-source/core/src/test/scala/org/apache/spark/SparkFunSuite.scala:268: [deprecation  org.apache.spark.SparkFunSuite.LogAppender.<init> | origin=org.apache.logging.log4j.core.appender.AbstractAppender.<init> | version=] constructor AbstractAppender in class AbstractAppender is deprecated
```

In order to fix the above compilation warning, the main change of this pr as follows:
1.  `Log4jFileAppender.Builder` is used instead of `Log4jFileAppender.createAppender` to fix compilation warning of `DriverLogger`, and the configuration of some default values is omitted refer to SPARK-6305.

The initial status of `Log4jFileAppender.Builder` as follows:

```java
fileName = null
append = true
locking = false
advertise = false
advertiseUri = null
createOnDemand = false
filePermissions = null
fileOwner = null
fileGroup = null
bufferedIo = true
bufferSize = 8192
immediateFlush = true
ignoreExceptions = true
layout = null
name = null
configuration = null
filter = null
propertyArray = null
```

And we can't use the chained API invocation mode because `AbstractFilterable.Builder.asBuilder()` method will return `Any` in Scala.

2. Use the recommended constructor of `AbstractAppender` refer to javadoc to fix compilation warning  in `SparkFunSuite`.

### Why are the changes needed?
Clean up deprecation compilation warning related to log4j2

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

### How was this patch tested?
Pass GA

Closes apache#35153 from LuciferYang/SPARK-37853.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 9c12c37)
@LuciferYang LuciferYang deleted the SPARK-37853 branch October 22, 2023 07:43
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.

5 participants