protected SimpleJSONLayout(final Configuration config, final boolean locationInfo, final boolean properties, final boolean complete, final boolean eventEol, final String headerPattern, final String footerPattern, final Charset charset, final KeyValuePair[] additionalFields) { super(config, charset, // PatternLayout.newSerializerBuilder() // .setConfiguration(config).setReplace(null).setPattern(headerPattern) // .setDefaultPattern(DEFAULT_HEADER) // .setPatternSelector(null).setAlwaysWriteExceptions(false).setNoConsoleNoAnsi(false) // .build(), // PatternLayout.newSerializerBuilder() // .setConfiguration(config).setReplace(null).setPattern(footerPattern) // .setDefaultPattern(DEFAULT_FOOTER) // .setPatternSelector(null).setAlwaysWriteExceptions(false).setNoConsoleNoAnsi(false) // .build()); this.locationInfo = locationInfo; this.properties = properties; this.complete = complete; this.additionalFields = additionalFields; this.layoutStartTime = System.currentTimeMillis(); this.layoutSequence = new AtomicLong(); this.interpolator = new Interpolator(new MapLookup(getConfiguration().getProperties()), getConfiguration().getPluginPackages()); this.eol = !eventEol ? COMPACT_EOL : DEFAULT_EOL; }
/** * Create the Properties component. * @param properties An array of Property elements. * @param config The Configuration. * @return An Interpolator that includes the configuration properties. */ @PluginFactory public static StrLookup configureSubstitutor(@PluginElement("Properties") final Property[] properties, @PluginConfiguration final Configuration config) { if (properties == null) { return new Interpolator(null); } final Map<String, String> map = new HashMap<String, String>(config.getProperties()); for (final Property prop : properties) { map.put(prop.getName(), prop.getValue()); } return new Interpolator(new MapLookup(map)); }
/** * Creates the Properties component. * @param properties An array of Property elements. * @param config The Configuration. * @return An Interpolator that includes the configuration properties. */ @PluginFactory public static StrLookup configureSubstitutor(@PluginElement("Properties") final Property[] properties, @PluginConfiguration final Configuration config) { if (properties == null) { return new Interpolator(config.getProperties()); } final Map<String, String> map = new HashMap<>(config.getProperties()); for (final Property prop : properties) { map.put(prop.getName(), prop.getValue()); } return new Interpolator(new MapLookup(map), config.getPluginPackages()); }