Package org.apache.logging.log4j.core.pattern

Examples of org.apache.logging.log4j.core.pattern.PatternParser


                         final Charset charset) {
        super(charset);
        this.replace = replace;
        this.conversionPattern = pattern;
        this.config = config;
        final PatternParser parser = createPatternParser(config);
        formatters = parser.parse(pattern == null ? DEFAULT_CONVERSION_PATTERN : pattern, true);
    }
View Full Code Here


    public void setConversionPattern(final String conversionPattern) {
        final String pattern = OptionConverter.convertSpecialChars(conversionPattern);
        if (pattern == null) {
            return;
        }
        final PatternParser parser = createPatternParser(this.config);
        formatters = parser.parse(pattern);
    }
View Full Code Here

     * @param config The Configuration.
     * @return The PatternParser.
     */
    public static PatternParser createPatternParser(final Configuration config) {
        if (config == null) {
            return new PatternParser(config, KEY, LogEventPatternConverter.class);
        }
        PatternParser parser = (PatternParser) config.getComponent(KEY);
        if (parser == null) {
            parser = new PatternParser(config, KEY, LogEventPatternConverter.class);
            config.addComponent(KEY, parser);
            parser = (PatternParser) config.getComponent(KEY);
        }
        return parser;
    }
View Full Code Here

    private RFC5424Layout(final Configuration config, final Facility facility, final String id, final int ein,
                          final boolean includeMDC, final boolean includeNL, final String escapeNL, final String mdcId,
                          final String appName, final String messageId, final String excludes, final String includes,
                          final String required, final Charset charset, final String exceptionPattern) {
        super(charset);
        final PatternParser parser = createPatternParser(config);
        formatters = exceptionPattern == null ? null : parser.parse(exceptionPattern, false);
        this.facility = facility;
        this.defaultId = id == null ? DEFAULT_ID : id;
        this.enterpriseNumber = ein;
        this.includeMDC = includeMDC;
        this.includeNewLine = includeNL;
View Full Code Here

     * @param config The Configuration.
     * @return The PatternParser.
     */
    public static PatternParser createPatternParser(final Configuration config) {
        if (config == null) {
            return new PatternParser(config, PatternLayout.KEY, LogEventPatternConverter.class,
                ThrowablePatternConverter.class);
        }
        PatternParser parser = (PatternParser) config.getComponent(COMPONENT_KEY);
        if (parser == null) {
            parser = new PatternParser(config, PatternLayout.KEY, ThrowablePatternConverter.class);
            config.addComponent(COMPONENT_KEY, parser);
            parser = (PatternParser) config.getComponent(COMPONENT_KEY);
        }
        return parser;
    }
View Full Code Here

                         final Charset charset) {
        super(charset);
        this.replace = replace;
        this.conversionPattern = pattern;
        this.config = config;
        PatternParser parser = createPatternParser(config);
        formatters = parser.parse((pattern == null) ? DEFAULT_CONVERSION_PATTERN : pattern);
        handlesExceptions = parser.handlesExceptions();
    }
View Full Code Here

    public void setConversionPattern(final String conversionPattern) {
        String pattern = OptionConverter.convertSpecialChars(conversionPattern);
        if (pattern == null) {
            return;
        }
        PatternParser parser = createPatternParser(this.config);
        formatters = parser.parse(pattern);
        handlesExceptions = parser.handlesExceptions();
    }
View Full Code Here

     * @param config The Configuration.
     * @return The PatternParser.
     */
    public static PatternParser createPatternParser(Configuration config) {
        if (config == null) {
            return new PatternParser(config, KEY, LogEventPatternConverter.class);
        }
        PatternParser parser = (PatternParser) config.getComponent(KEY);
        if (parser == null) {
            parser = new PatternParser(config, KEY, LogEventPatternConverter.class);
            config.addComponent(KEY, parser);
            parser = (PatternParser) config.getComponent(KEY);
        }
        return parser;
    }
View Full Code Here

    /**
     * Constructor.
     * @param pattern The file pattern.
     */
    public PatternProcessor(String pattern) {
        PatternParser parser = createPatternParser();
        List<PatternConverter> converters = new ArrayList<PatternConverter>();
        List<FormattingInfo> fields = new ArrayList<FormattingInfo>();
        parser.parse(pattern, converters, fields);
        FormattingInfo[] infoArray = new FormattingInfo[fields.size()];
        patternFields = fields.toArray(infoArray);
        ArrayPatternConverter[] converterArray = new ArrayPatternConverter[converters.size()];
        patternConverters = converters.toArray(converterArray);

View Full Code Here

        return null;
    }

    private PatternParser createPatternParser() {

        return new PatternParser(null, KEY, null);
    }
View Full Code Here

TOP

Related Classes of org.apache.logging.log4j.core.pattern.PatternParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.