You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "jhl221123 (via GitHub)" <gi...@apache.org> on 2025/05/06 19:32:59 UTC

[PR] Prevent NPE with rootLogger shorthand when no appenders are specified [logging-log4j2]

jhl221123 opened a new pull request, #3650:
URL: https://github.com/apache/logging-log4j2/pull/3650

   This pull request addresses issue #3206, which could lead to a `NullPointerException` when using the shorthand notation for the root logger (e.g., rootLogger = INFO) in `log4j2.properties` without explicitly defining any appender references.
   
   To resolve this, the static helper method `LoggerConfig.getLevelAndRefs()` has been updated to ensure that the `LevelAndRefs` container always holds a non-null list of `AppenderRef` objects. When no appenders are specified in the shorthand string, the method has been updated to return an empty list instead of `null`.
   
   ## Checklist
   
   * Base your changes on `2.x` branch if you are targeting Log4j 2; use `main` otherwise
   * `./mvnw verify` succeeds (if it fails due to code formatting issues reported by Spotless, simply run `./mvnw spotless:apply` and retry)
   * Non-trivial changes contain an entry file in the `src/changelog/.2.x.x` directory
   * Tests for the changes are provided
   * [Commits are signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) (optional, but highly recommended)
   


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Prevent NPE with rootLogger shorthand when no appenders are specified [logging-log4j2]

Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on PR #3650:
URL: https://github.com/apache/logging-log4j2/pull/3650#issuecomment-2863101484

   > I've added the changelog entry. I appreciate your guidance and review!
   
   Thanks!
   
   For some reason I don't fully understand the required GitHub Action workflows didn't start on your last commit.
   
   - @vy any idea why?
   - @jhl221123, could you try updating the branch again, e.g. `git rebase -f origin/2.x; git push -f`? Maybe it is a temporary problem and it will work for the next commit.


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Prevent NPE with rootLogger shorthand when no appenders are specified [logging-log4j2]

Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz merged PR #3650:
URL: https://github.com/apache/logging-log4j2/pull/3650


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Prevent NPE with rootLogger shorthand when no appenders are specified [logging-log4j2]

Posted by "jhl221123 (via GitHub)" <gi...@apache.org>.
jhl221123 commented on PR #3650:
URL: https://github.com/apache/logging-log4j2/pull/3650#issuecomment-2862941871

   Thanks, @ppkarwasz! I've added the changelog entry. I appreciate your guidance and review!


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Prevent NPE with rootLogger shorthand when no appenders are specified [logging-log4j2]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3650:
URL: https://github.com/apache/logging-log4j2/pull/3650#issuecomment-2856048962

   
   
   <table>
       <tr>
           <th>Job</th>
           <th>Requested goals</th>
           <th>Build Tool Version</th>
           <th>Build Outcome</th>
           <th>Build ScanĀ®</th>
       </tr>
       <tr>
           <td>build-macos-latest</td>
           <td>clean install</td>
           <td align='center'>3.9.8</td>
           <td align='center'>:white_check_mark:</td>
           <td><a href="https://develocity.apache.org/s/6j3qogybrb3ey" rel="nofollow"><img src="https://img.shields.io/badge/Build%20Scan%C2%AE-PUBLISHED-06A0CE?logo=Gradle" alt="Build Scan PUBLISHED" /></a></td>
       </tr>
       <tr>
           <td>build-ubuntu-latest</td>
           <td>clean install</td>
           <td align='center'>3.9.8</td>
           <td align='center'>:white_check_mark:</td>
           <td><a href="https://develocity.apache.org/s/pnjzhyecltwa2" rel="nofollow"><img src="https://img.shields.io/badge/Build%20Scan%C2%AE-PUBLISHED-06A0CE?logo=Gradle" alt="Build Scan PUBLISHED" /></a></td>
       </tr>
       <tr>
           <td>build-windows-latest</td>
           <td>clean install</td>
           <td align='center'>3.9.8</td>
           <td align='center'>:white_check_mark:</td>
           <td><a href="https://develocity.apache.org/s/qqdsnt6vrp5xc" rel="nofollow"><img src="https://img.shields.io/badge/Build%20Scan%C2%AE-PUBLISHED-06A0CE?logo=Gradle" alt="Build Scan PUBLISHED" /></a></td>
       </tr>
   </table>
       
   
   ###### Generated by gradle/develocity-actions
   


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org