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


   ### 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
   ```
   
   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  of `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


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to