Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notEmpty still outputs text when variable is empty #1922

Closed
simontankersley opened this issue Oct 30, 2023 · 5 comments
Closed

notEmpty still outputs text when variable is empty #1922

simontankersley opened this issue Oct 30, 2023 · 5 comments
Assignees
Labels
bug Incorrect, unexpected, or unintended behavior of existing code layouts Affects one or more Layout plugins
Milestone

Comments

@simontankersley
Copy link

simontankersley commented Oct 30, 2023

Description

As per the documentation on https://logging.apache.org/log4j/2.x/manual/layouts.html, log4j2 has a Conversion Pattern called notEmpty that:

Outputs the result of evaluating the pattern if and only if all variables in the pattern are not empty.

In version 2.20.0 of log4j2, this works as expected but in version 2.21.0 and above (at time of creating the issue) it doesn't.

Please see Reproduction section for more details.

Configuration

Version: 2.21.0 and 2.21.1

Operating system: Mac OS 14.0

JDK: openjdk 17.0.5

Logs

Please see Reproduction section for details.

Reproduction

Please see https://github.com/simontankersley/log4j2_notEmpty_bug#readme

@vy vy self-assigned this Oct 31, 2023
@vy
Copy link
Member

vy commented Oct 31, 2023

@simontankersley, thanks for the report, I will check it out.

@linhartJ
Copy link

Having the same issue.

@vy
Copy link
Member

vy commented Nov 1, 2023

@simontankersley, @linhartJ, problem should be fixed by dd4a88a. Would you mind giving 2.22.0-SNAPSHOT a try once the associated CI run successfully finishes, please? (See this section of the manual on how to add snapshot repositories.)

@simontankersley, thanks so much again for the report and for taking time to create a reproduction. 😍 🙇 Feel free to comment/re-open the issue if the fix doesn't work for you.

@vy vy closed this as completed Nov 1, 2023
@vy vy added bug Incorrect, unexpected, or unintended behavior of existing code layouts Affects one or more Layout plugins labels Nov 1, 2023
@vy vy added this to the 2.22.0 milestone Nov 1, 2023
@simontankersley
Copy link
Author

simontankersley commented Nov 1, 2023

Would you mind giving 2.22.0-SNAPSHOT a try once the associated CI run successfully finishes, please?

I can confirm, things work as expected again in 2.22.0-SNAPSHOT. Thanks for turning this around so quickly!

@class101
Copy link

class101 commented Nov 6, 2023

@vy I also confirm 2.22.0-SNAPSHOT fixes the regression I also duplicated in #1946

Sorry for the duplicate and thanks again guys for the fast intervention :)

dongjoon-hyun pushed a commit to apache/spark that referenced this issue Nov 22, 2023
### What changes were proposed in this pull request?
The pr aims to upgrade log4j2 from 2.21.0 to 2.22.0.

### Why are the changes needed?
This is the first log4j2 version that provides a CycloneDX Software Bill of Materials (SBOM) and the new version bring some new change and fix like:
- Change the order of evaluation of FormattedMessage formatters. Messages are evaluated using java.util.Format only if they don't comply to the java.text.MessageFormat or ParameterizedMessage format. (apache/logging-log4j2#1223)
- Change default encoding of HTTP Basic Authentication to UTF-8 and add log4j2.configurationAuthorizationEncoding property to overwrite it. (apache/logging-log4j2#1970)
- Removed unused FastDateParser which was causing unnecessary heap overhead ([LOG4J2-3672](https://issues.apache.org/jira/browse/LOG4J2-3672), apache/logging-log4j2#1848)
- Fix MDC pattern converter causing issues for %notEmpty (apache/logging-log4j2#1922)
- Fix NotSerializableException thrown when Logger is serialized with a ReusableMessageFactory (apache/logging-log4j2#1884)

the full release note as follows:
-https://github.com/apache/logging-log4j2/releases/tag/rel%2F2.22.0

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

### How was this patch tested?
Pass GitHub Actions

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #43940 from LuciferYang/SPARK-46038.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect, unexpected, or unintended behavior of existing code layouts Affects one or more Layout plugins
Projects
None yet
Development

No branches or pull requests

4 participants