/** * Internal method that resolves the value of a variable. * <p> * Most users of this class do not need to call this method. This method is * called automatically by the substitution process. * <p> * Writers of subclasses can override this method if they need to alter * how each substitution occurs. The method is passed the variable's name * and must return the corresponding value. This implementation uses the * {@link #getVariableResolver()} with the variable's name as the key. * * @param variableName the name of the variable, not null * @param buf the buffer where the substitution is occurring, not null * @param startPos the start position of the variable including the prefix, valid * @param endPos the end position of the variable including the suffix, valid * @return the variable's value or <b>null</b> if the variable is unknown */ protected String resolveVariable(String variableName, StrBuilder buf, int startPos, int endPos) { StrLookup resolver = getVariableResolver(); if (resolver == null) { return null; } return resolver.lookup(variableName); }
@Override public String lookup(String key) { return Pattern.quote(_int.getDefaultLookup().lookup(key)); } });
@Override public String lookup(String key) { return Pattern.quote(_int.getDefaultLookup().lookup(key)); } });
/** * Internal method that resolves the value of a variable. * <p> * Most users of this class do not need to call this method. This method is * called automatically by the substitution process. * <p> * Writers of subclasses can override this method if they need to alter * how each substitution occurs. The method is passed the variable's name * and must return the corresponding value. This implementation uses the * {@link #getVariableResolver()} with the variable's name as the key. * * @param variableName the name of the variable, not null * @param buf the buffer where the substitution is occurring, not null * @param startPos the start position of the variable including the prefix, valid * @param endPos the end position of the variable including the suffix, valid * @return the variable's value or <b>null</b> if the variable is unknown */ protected String resolveVariable(String variableName, StrBuilder buf, int startPos, int endPos) { StrLookup resolver = getVariableResolver(); if (resolver == null) { return null; } return resolver.lookup(variableName); }
/** * Internal method that resolves the value of a variable. * <p> * Most users of this class do not need to call this method. This method is * called automatically by the substitution process. * <p> * Writers of subclasses can override this method if they need to alter * how each substitution occurs. The method is passed the variable's name * and must return the corresponding value. This implementation uses the * {@link #getVariableResolver()} with the variable's name as the key. * * @param variableName the name of the variable, not null * @param buf the buffer where the substitution is occurring, not null * @param startPos the start position of the variable including the prefix, valid * @param endPos the end position of the variable including the suffix, valid * @return the variable's value or <b>null</b> if the variable is unknown */ protected String resolveVariable(String variableName, StrBuilder buf, int startPos, int endPos) { StrLookup resolver = getVariableResolver(); if (resolver == null) { return null; } return resolver.lookup(variableName); }
/** * Internal method that resolves the value of a variable. * <p> * Most users of this class do not need to call this method. This method is * called automatically by the substitution process. * <p> * Writers of subclasses can override this method if they need to alter * how each substitution occurs. The method is passed the variable's name * and must return the corresponding value. This implementation uses the * {@link #getVariableResolver()} with the variable's name as the key. * * @param variableName the name of the variable, not null * @param buf the buffer where the substitution is occurring, not null * @param startPos the start position of the variable including the prefix, valid * @param endPos the end position of the variable including the suffix, valid * @return the variable's value or <b>null</b> if the variable is unknown */ protected String resolveVariable(String variableName, StrBuilder buf, int startPos, int endPos) { StrLookup resolver = getVariableResolver(); if (resolver == null) { return null; } return resolver.lookup(variableName); }
/** * Internal method that resolves the value of a variable. * <p> * Most users of this class do not need to call this method. This method is * called automatically by the substitution process. * <p> * Writers of subclasses can override this method if they need to alter * how each substitution occurs. The method is passed the variable's name * and must return the corresponding value. This implementation uses the * {@link #getVariableResolver()} with the variable's name as the key. * * @param variableName the name of the variable, not null * @param buf the buffer where the substitution is occurring, not null * @param startPos the start position of the variable including the prefix, valid * @param endPos the end position of the variable including the suffix, valid * @return the variable's value or <b>null</b> if the variable is unknown */ protected String resolveVariable(String variableName, StrBuilder buf, int startPos, int endPos) { StrLookup resolver = getVariableResolver(); if (resolver == null) { return null; } return resolver.lookup(variableName); }
/** * Internal method that resolves the value of a variable. * <p> * Most users of this class do not need to call this method. This method is * called automatically by the substitution process. * <p> * Writers of subclasses can override this method if they need to alter * how each substitution occurs. The method is passed the variable's name * and must return the corresponding value. This implementation uses the * {@link #getVariableResolver()} with the variable's name as the key. * * @param variableName the name of the variable, not null * @param buf the buffer where the substitution is occurring, not null * @param startPos the start position of the variable including the prefix, valid * @param endPos the end position of the variable including the suffix, valid * @return the variable's value or <b>null</b> if the variable is unknown */ protected String resolveVariable(String variableName, StrBuilder buf, int startPos, int endPos) { StrLookup resolver = getVariableResolver(); if (resolver == null) { return null; } return resolver.lookup(variableName); }
final LoggerContext loggerContext = (LoggerContext) LogManager.getContext(true); final Configuration config = loggerContext.getConfiguration(); final StrSubstitutor strSubstitutor = config.getStrSubstitutor(); final StrLookup variableResolver = strSubstitutor.getVariableResolver(); final String propertyValue = variableResolver.lookup("propertyName");
String value = fetchLookupForPrefix(prefix).lookup(name); if (value == null && getParentInterpolator() != null) value = getParentInterpolator().fetchLookupForPrefix(prefix).lookup(name); String value = fetchNoPrefixLookup().lookup(var); if (value == null && getParentInterpolator() != null) value = getParentInterpolator().fetchNoPrefixLookup().lookup(var);