You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "jmpalomar (via GitHub)" <gi...@apache.org> on 2024/03/05 09:40:26 UTC

[I] EnvironmentPropertySource skipping all environment properties (logging-log4j2)

jmpalomar opened a new issue, #2347:
URL: https://github.com/apache/logging-log4j2/issues/2347

   ## 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:
   ```
       protected Map<String, Properties> parseProperties(final Map<String, String> properties) {
           final Map<String, Properties> propertiesMap = new ConcurrentHashMap<>();
           for (String propName : properties.keySet()) {
               if (propName.startsWith(PREFIX)) {
                   storeProperty(propertiesMap, propName, properties.get(propName));
               }
           }
           return propertiesMap;
       }
   ```
   
   ## 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
   


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

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


Re: [I] EnvironmentPropertySource skipping all environment properties (logging-log4j2)

Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on issue #2347:
URL: https://github.com/apache/logging-log4j2/issues/2347#issuecomment-1978606151

   Hi @jmpalomar,
   
   Thank you for reporting the issue.
   
   We are currently removing the `log4j-api` artifact from the `main` branch (cf. #2290), so the problem should solve itself, when we rebase it on `log4j-api` 2.x.
   
   I have fixed a similar problem with environment variables in the `feature/log4j-sdk`, which we use for the #2290 task (cf. 7c09141a56f8d8ff670747e995ba57f4bf954470), but I would like to keep this issue open until we actually merge the branches, to prevent regressions.


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