public static String renderString()

in log4j-tools-internal-freemarker-util/src/main/java/org/apache/logging/log4j/tools/internal/freemarker/util/FreeMarkerUtils.java [99:115]


    public static String renderString(final String templateString, final Object templateData) {
        final Configuration configuration = new Configuration(CONFIGURATION_VERSION);
        final DefaultObjectWrapperBuilder objectWrapperBuilder = new DefaultObjectWrapperBuilder(CONFIGURATION_VERSION);
        objectWrapperBuilder.setExposeFields(true);
        final DefaultObjectWrapper objectWrapper = objectWrapperBuilder.build();
        configuration.setObjectWrapper(objectWrapper);
        try {
            final Template template =
                    new Template("ephemeralInlineTemplate", new StringReader(templateString), configuration);
            final Writer templateWriter = new StringWriter();
            template.process(templateData, templateWriter);
            return templateWriter.toString();
        } catch (final Exception error) {
            final String message = String.format("failed rendering template `%s`", templateString);
            throw new RuntimeException(message, error);
        }
    }