Examples of PatternParser


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

     * @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 = 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

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

                          final String mdcPrefix, final String eventPrefix,
                          final String appName, final String messageId, final String excludes, final String includes,
                          final String required, final Charset charset, final String exceptionPattern,
                          final boolean useTLSMessageFormat, final LoggerFields[] loggerFields) {
        super(charset);
        final PatternParser exceptionParser = createPatternParser(config, ThrowablePatternConverter.class);
        exceptionFormatters = exceptionPattern == null ? null : exceptionParser.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

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

            for (final LoggerFields lField : loggerFields) {
                final StructuredDataId key = lField.getSdId() == null ? mdcSDID : lField.getSdId();
                final Map<String, List<PatternFormatter>> sdParams = new HashMap<String, List<PatternFormatter>>();
                final Map<String, String> fields = lField.getMap();
                if (!fields.isEmpty()) {
                    final PatternParser fieldParser = createPatternParser(config, null);

                    for (final Map.Entry<String, String> entry : fields.entrySet()) {
                        final List<PatternFormatter> formatters = fieldParser.parse(entry.getValue(), false);
                        sdParams.put(entry.getKey(), formatters);
                    }
                    final FieldFormatter fieldFormatter = new FieldFormatter(sdParams,
                            lField.getDiscardIfAllFieldsAreEmpty());
                    sdIdMap.put(key.toString(), fieldFormatter);
View Full Code Here

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

     * @return The PatternParser.
     */
    private static PatternParser createPatternParser(final Configuration config,
            final Class<? extends PatternConverter> filterClass) {
        if (config == null) {
            return new PatternParser(config, PatternLayout.KEY, LogEventPatternConverter.class, filterClass);
        }
        PatternParser parser = 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

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

    /**
     * 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);

View Full Code Here

Examples of org.apache.servicemix.gshell.log.layout.PatternParser

    public void setPattern(String pattern) {
        this.pattern = pattern;
    }

    protected Object doExecute() throws Exception {
        PatternConverter cnv = new PatternParser(overridenPattern != null ? overridenPattern : pattern).parse();

        Iterable<PaxLoggingEvent> le = events.getElements(entries == 0 ? Integer.MAX_VALUE : entries);
        StringBuffer sb = new StringBuffer();
        for (PaxLoggingEvent event : le) {
            sb.setLength(0);
View Full Code Here

Examples of org.apache.servicemix.kernel.gshell.log.layout.PatternParser

    public void setPattern(String pattern) {
        this.pattern = pattern;
    }

    protected Object doExecute() throws Exception {
        PatternConverter cnv = new PatternParser(overridenPattern != null ? overridenPattern : pattern).parse();

        Iterable<PaxLoggingEvent> le = events.getElements(entries == 0 ? Integer.MAX_VALUE : entries);
        StringBuffer sb = new StringBuffer();
        for (PaxLoggingEvent event : le) {
            sb.setLength(0);
View Full Code Here

Examples of org.aspectj.weaver.patterns.PatternParser

    EclipseSourceContext eSourceContext = new EclipseSourceContext(md.compilationResult);
    Pointcut pc = null;
    if (!md.isAbstract()) {
      String expression = getPointcutStringFromAnnotationStylePointcut(md);
      try {
        pc = new PatternParser(expression, eSourceContext).parsePointcut();
      } catch (ParserException pe) { // error will be reported by other
        // means...
        pc = Pointcut.makeMatchesNothing(Pointcut.SYMBOLIC);
      }
    }
View Full Code Here

Examples of org.aspectj.weaver.patterns.PatternParser

    public void addScopedAspect(String aspectName, String scope) {
      ensureInitialized();
      resolvedIncludedAspects.add(aspectName);
      try {
        TypePattern scopePattern = new PatternParser(scope).parseTypePattern();
        scopePattern.resolve(world);
        scopes.put(aspectName, scopePattern);
        if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) {
          world.getMessageHandler().handleMessage(
              MessageUtil.info("Aspect '" + aspectName + "' is scoped to apply against types matching pattern '"
View Full Code Here

Examples of org.aspectj.weaver.patterns.PatternParser

              // }
              String scope = definition.getScopeForAspect(name);
              if (scope != null) {
                // Resolve the type pattern
                try {
                  TypePattern scopePattern = new PatternParser(scope).parseTypePattern();
                  scopePattern.resolve(world);
                  scopes.put(name, scopePattern);
                  if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) {
                    world.getMessageHandler().handleMessage(
                        MessageUtil.info("Aspect '" + name
                            + "' is scoped to apply against types matching pattern '"
                            + scopePattern.toString() + "'"));
                  }
                } catch (Exception e) {
                  // TODO definitions should remember which file they came from, for inclusion in this message
                  world.getMessageHandler().handleMessage(
                      MessageUtil.error("Unable to parse scope as type pattern.  Scope was '" + scope + "': "
                          + e.getMessage()));
                }
              }
            }
            try {
              List<String> includePatterns = definition.getIncludePatterns();
              if (includePatterns.size() > 0) {
                includedPatterns = new ArrayList<TypePattern>();
                includedFastMatchPatterns = new ArrayList<String>();
              }
              for (String includePattern : includePatterns) {
                if (includePattern.endsWith("..*")) {
                  // from 'blah.blah.blah..*' leave the 'blah.blah.blah.'
                  includedFastMatchPatterns.add(includePattern.substring(0, includePattern.length() - 2));
                } else {
                  TypePattern includedPattern = new PatternParser(includePattern).parseTypePattern();
                  includedPatterns.add(includedPattern);
                }
              }
              List<String> excludePatterns = definition.getExcludePatterns();
              if (excludePatterns.size() > 0) {
                excludedPatterns = new ArrayList<TypePattern>();
                excludedFastMatchPatterns = new ArrayList<String>();
              }
              for (String excludePattern : excludePatterns) {
                if (excludePattern.endsWith("..*")) {
                  // from 'blah.blah.blah..*' leave the 'blah.blah.blah.'
                  excludedFastMatchPatterns.add(excludePattern.substring(0, excludePattern.length() - 2));
                } else {
                  TypePattern excludedPattern = new PatternParser(excludePattern).parseTypePattern();
                  excludedPatterns.add(excludedPattern);
                }
              }
            } catch (ParserException pe) {
              // TODO definitions should remember which file they came from, for inclusion in this message
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.