DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14350>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14350 Patch to substitute variables in the log4j.configuration property Summary: Patch to substitute variables in the log4j.configuration property Product: Log4j Version: 1.3alpha Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Other AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Submitted by: Michael Locher <[EMAIL PROTECTED]> Hi all I had to find a way to provide a user dependent configuration file for my java webstart application. the stright forward way to do so, is to handle property substitution in the LogManager initalisation. webstart users can provide something like this: <property name="log4j.configuration" value="file:// ${user.home}/log4j.properties" /> the substitiution code was already there, so the patch is quite small. one new method in OptionConverter and 3 renamings in LogManager. In what format do you expect the patch? I have included a diff against CVS HEAD below. Regards Michael Locher ##################################################################### diff -r1.37 OptionConverter.java 20a21 > // Michael Locher ([EMAIL PROTECTED]) 98a100,120 > /** > Very similar to <code>System.getProperty</code> except > that the {@link SecurityException} is hidden and substitutions are perfor med. > > @param key The key to search for. > @param def The default value to return. > @return the string value of the system property with applied substitution s, or the default > value if there is no property with that key. > */ > public > static > String getSubstitutedSystemProperty(String key, String def) { > try { > Properties systemProperties = System.getProperties(); > return OptionConverter.substVars(OptionConverter.getSystemProperty(key , def), > System.getProperties()); > } catch(Throwable e) { // MS-Java throws com.ms.security.SecurityExcepti onEx > LogLog.debug("Was not allowed to read system properties."); > return def; > } > } ##################################################################### diff -r1.9 LogManager.java 78,79c78,79 < String override =OptionConverter.getSystemProperty(DEFAULT_INIT_OVERRIDE_K EY, < null); --- > String override =OptionConverter.getSubstitutedSystemProperty(DEFAULT_INIT _OVERRIDE_KEY, > null); 85c85 < String configurationOptionStr = OptionConverter.getSystemProperty( --- > String configurationOptionStr = OptionConverter.getSubstitutedSystemProp erty( 89c89 < String configuratorClassName = OptionConverter.getSystemProperty( --- > String configuratorClassName = OptionConverter.getSubstitutedSystemPrope rty( ##################################################################### -- To unsubscribe, e-mail: <mailto:log4j-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:log4j-dev-help@;jakarta.apache.org>