Java Code Examples for org.apache.log4j.helpers.OptionConverter#substVars()
The following examples show how to use
org.apache.log4j.helpers.OptionConverter#substVars() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OptionConverterTestCase.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void varSubstTest1() { String r; r = OptionConverter.substVars("hello world.", null); assertEquals("hello world.", r); r = OptionConverter.substVars("hello ${TOTO} world.", null); assertEquals("hello wonderful world.", r); }
Example 2
Source File: OptionConverterTestCase.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void varSubstTest2() { String r; r = OptionConverter.substVars("Test2 ${key1} mid ${key2} end.", null); assertEquals("Test2 value1 mid value2 end.", r); }
Example 3
Source File: OptionConverterTestCase.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void varSubstTest3() { String r; r = OptionConverter.substVars( "Test3 ${unset} mid ${key1} end.", null); assertEquals("Test3 mid value1 end.", r); }
Example 4
Source File: OptionConverterTestCase.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void varSubstTest4() { String res; String val = "Test4 ${incomplete "; try { res = OptionConverter.substVars(val, null); } catch(IllegalArgumentException e) { String errorMsg = e.getMessage(); //System.out.println('['+errorMsg+']'); assertEquals('"'+val + "\" has no closing brace. Opening brace at position 6.", errorMsg); } }
Example 5
Source File: OptionConverterTestCase.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void varSubstTest5() { Properties props = new Properties(); props.put("p1", "x1"); props.put("p2", "${p1}"); String res = OptionConverter.substVars("${p2}", props); System.out.println("Result is ["+res+"]."); assertEquals(res, "x1"); }
Example 6
Source File: DOMConfigurator.java From cacheonix-core with GNU Lesser General Public License v2.1 | 3 votes |
/** * Substitutes property value for any references in expression. * * @param value value from configuration file, may contain * literal text, property references or both * @param props properties. * @return evaluated expression, may still contain expressions * if unable to expand. * @since 1.2.15 */ public static String subst(final String value, final Properties props) { try { return OptionConverter.substVars(value, props); } catch (IllegalArgumentException e) { LogLog.warn("Could not perform variable substitution.", e); return value; } }
Example 7
Source File: XmlConfiguration.java From logging-log4j2 with Apache License 2.0 | 3 votes |
/** * Substitutes property value for any references in expression. * * @param value value from configuration file, may contain * literal text, property references or both * @param props properties. * @return evaluated expression, may still contain expressions * if unable to expand. */ public String subst(final String value, final Properties props) { try { return OptionConverter.substVars(value, props); } catch (IllegalArgumentException e) { LOGGER.warn("Could not perform variable substitution.", e); return value; } }
Example 8
Source File: XmlConfigurationFactory.java From logging-log4j2 with Apache License 2.0 | 3 votes |
/** * Substitutes property value for any references in expression. * * @param value value from configuration file, may contain * literal text, property references or both * @param props properties. * @return evaluated expression, may still contain expressions * if unable to expand. */ public static String subst(final String value, final Properties props) { try { return OptionConverter.substVars(value, props); } catch (IllegalArgumentException e) { LOGGER.warn("Could not perform variable substitution.", e); return value; } }