yaooqinn opened a new pull request #28580:
URL: https://github.com/apache/spark/pull/28580


   
   
   
   
   ### What changes were proposed in this pull request?
   
   in `spark-daemon.sh`, `spark_rotate_log()` accepts `$2` as a custom setting 
for the number of maximum rotate log files, but this part of code is actually 
never used.
   
   This PR adds `SPARK_LOG_MAX_FILES` environment variable to represent the 
maximum log files of Spark daemons can rotate to.
   
   
   ### Why are the changes needed?
   
   the logs files that all spark daemons are hardcoded as 5, but it supposed to 
be configurable
   
   ### Does this PR introduce _any_ user-facing change?
   
   yes, SPARK_LOG_MAX_FILES is added to represent the maximum log files of 
Spark daemons can rotate to. 
   
   ### How was this patch tested?
   
   verify locally for the added shell script:
   
   ```shell
    kentyao@hulk  ~  SPARK_LOG_MAX_FILES=5 sh test.sh
   5
    kentyao@hulk  ~  SPARK_LOG_MAX_FILES=a sh test.sh
   5
    kentyao@hulk  ~  SPARK_LOG_MAX_FILES=6 sh test.sh
   6
    kentyao@hulk  ~  sh test.sh
   5
    kentyao@hulk  ~  cat test.sh
   #!/bin/bash
   
   if [[ ${SPARK_LOG_MAX_FILES} -gt 5 ]] 2>/dev/null; then
         num=${SPARK_LOG_MAX_FILES}
       else
         num=5
       fi
   
   echo $num
   ```
   


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

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