You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2011/05/28 10:04:20 UTC

DO NOT REPLY [Bug 51279] New: log4j.properties doesn't support environment variable

https://issues.apache.org/bugzilla/show_bug.cgi?id=51279

             Bug #: 51279
           Summary: log4j.properties doesn't support environment variable
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Configurator
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: zhym001@gmail.com
    Classification: Unclassified


Suggested solution:
in src\java\org\apache\log4j\helpers\OptionConverter.java
relace 
// first try in System properties
     String replacement = getSystemProperty(key, null);
with 
// then try in environment properties
     if (replacement == null) {
         replacement = getEnvProperty(key, null);
     }

And add function 
public String getEnvProperty(String key, String def) {
    try {
        String value = System.getenv(key);
        if (value == null) {
            value = def;
        }
      return value;
    } catch(Throwable e) {
      return def;
    }
  }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org