apache / apache/logging-log4j2

EnvironmentPropertySource skipping all environment properties

Open
#2,347 1 comment 0 reactions 1 assignee Claimed by @ppkarwasz View on GitHub
bug
Dominant language
Java
Stars
3.6k
Forks
1.7k
Avg merge
21h 30m
Merged PRs (30d)
27

Description

## Description

`EnvironmentPropertySource` is not adding any property from environment variables.

Problem is in `parseProperties` method from `ContextAwarePropertySource` which skips values depending on a `PREFIX` bu prefix value is `log4j2.` so all entries of `System.getenv()` map are skipped:

https://github.com/apache/logging-log4j2/blob/1831bc47e4e375b02b9325fab36a82575407fad9/log4j-api/src/main/java/org/apache/logging/log4j/util/ContextAwarePropertySource.java#L107-L115

## Configuration

**Version:** 3.0.0-beta2

**Operating system:** Mac OSX

**JDK:** JDK 17

## Reproduction

Provided an example project https://github.com/jmpalomar/log4j-environment-property-source-issue

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.