Java 类org.apache.logging.log4j.core.pattern.PatternConverter 实例源码

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

    for (final ArrayPatternConverter converter : patternConverters) {
        if (converter instanceof DatePatternConverter) {
            final DatePatternConverter dateConverter = (DatePatternConverter) converter;
            frequency = calculateFrequency(dateConverter.getPattern());
        }
    }
}
项目:logging-log4j2    文件:PatternProcessor.java   
/**
 * Constructor.
 * @param pattern The file pattern.
 */
public PatternProcessor(final String pattern) {
    this.pattern = pattern;
    final PatternParser parser = createPatternParser();
    final List<PatternConverter> converters = new ArrayList<>();
    final List<FormattingInfo> fields = new ArrayList<>();
    parser.parse(pattern, converters, fields, false, false, false);
    final FormattingInfo[] infoArray = new FormattingInfo[fields.size()];
    patternFields = fields.toArray(infoArray);
    final ArrayPatternConverter[] converterArray = new ArrayPatternConverter[converters.size()];
    patternConverters = converters.toArray(converterArray);

    for (final ArrayPatternConverter converter : patternConverters) {
        if (converter instanceof DatePatternConverter) {
            final DatePatternConverter dateConverter = (DatePatternConverter) converter;
            frequency = calculateFrequency(dateConverter.getPattern());
        }
    }
}
项目:x-pipe    文件:LogTest.java   
@Test
public void testPlugin(){

    PluginManager pm = new PluginManager(PatternConverter.CATEGORY);
    pm.collectPlugins();
    for(Entry<String, PluginType<?>> entry : pm.getPlugins().entrySet()){

        logger.info("{} : {}", entry.getKey(), entry.getValue());

    }

    logger.error("[testPlugin]", new IOException("io exception message..."));
}