Package ch.qos.logback.classic

Examples of ch.qos.logback.classic.PatternLayout


        lc.reset();

        ConsoleAppender<ILoggingEvent> consoleAppender = new ConsoleAppender<ILoggingEvent>() {{
            setContext(lc);
            setTarget("System.err");
            setLayout(new PatternLayout() {{
                setPattern("%msg%n%ex");
                setContext(lc);
                start();
            }});
            start();
View Full Code Here


            // [%thread] %logger %msg%n
            logBackPattern = MessageFormat.format(logBackPattern, "zero", "%marker", "%thread", "%logger", "%level",
                "%message") + "%n";
        }

        PatternLayout pl = new PatternLayout();
        pl.setPattern(logBackPattern);
        pl.setOutputPatternAsHeader(false);
        pl.setContext(loggerContext);
        pl.start();
        return pl;
    }
View Full Code Here

        // Init GSON for underscores
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
        this.gson = gsonBuilder.create();
        this.patternLayout = new PatternLayout();
        this.patternLayout.setContext(new LoggerContext());
        this.patternLayout.setPattern(messagePattern);
        this.patternLayout.start();
       
        if ( shortMessagePattern == null ) {
            this.shortPatternLayout = null;
        } else {
            this.shortPatternLayout = new PatternLayout();
            this.shortPatternLayout.setContext(new LoggerContext());
            this.shortPatternLayout.setPattern(shortMessagePattern);
            this.shortPatternLayout.start();
        }
    }
View Full Code Here

      tp = tp.getCause();
    }
  }

  public Layout<ILoggingEvent> buildLayout() {
    PatternLayout layout = new PatternLayout();
    layout.getInstanceConverterMap().put("syslogStart",
            SyslogStartConverter.class.getName());
    if (suffixPattern == null) {
      suffixPattern = DEFAULT_SUFFIX_PATTERN;
    }
    layout.setPattern(getPrefixPattern() + suffixPattern);
    layout.setContext(getContext());
    layout.start();
    return layout;
   }
View Full Code Here

    return false;
  }

  public Layout<ILoggingEvent> buildLayout() {
    PatternLayout layout = new PatternLayout();
    layout.getInstanceConverterMap().put("syslogStart",
            SyslogStartConverter.class.getName());
    if (suffixPattern == null) {
      suffixPattern = DEFAULT_SUFFIX_PATTERN;
    }
    layout.setPattern(getPrefixPattern() + suffixPattern);
    layout.setContext(getContext());
    layout.start();
    return layout;
  }
View Full Code Here

 
  static final public String DEFAULT_SUFFIX_PATTERN = "[%thread] %logger %m%exception";
 
  public Layout buildLayout(String facilityStr) {
 
    PatternLayout pl = new PatternLayout();
    pl.getInstanceConverterMap().put("syslogStart", SyslogStartConverter.class.getName());
   
    if(prefixPattern == null) {
      prefixPattern = "%syslogStart{"+facilityStr+"}";
    }
   
    if(suffixPattern == null) {
      suffixPattern = DEFAULT_SUFFIX_PATTERN;
    }
   
    pl.setPattern(prefixPattern+suffixPattern);
    pl.setContext(getContext());
    pl.start();
    return pl;
  }
View Full Code Here

public class PatternLayoutEncoder extends PatternLayoutEncoderBase<ILoggingEvent> {

  @Override
  public void start() {
    PatternLayout patternLayout = new PatternLayout();
    patternLayout.setContext(context);
    patternLayout.setPattern(getPattern());
    patternLayout.setOutputPatternAsHeader(outputPatternAsHeader);
    patternLayout.start();
    this.layout = patternLayout;
    super.start();
  }
View Full Code Here

    return false;
  }

  public Layout<ILoggingEvent> buildLayout() {
    PatternLayout layout = new PatternLayout();
    layout.getInstanceConverterMap().put("syslogStart",
            SyslogStartConverter.class.getName());
    if (suffixPattern == null) {
      suffixPattern = DEFAULT_SUFFIX_PATTERN;
    }
    layout.setPattern(getPrefixPattern() + suffixPattern);
    layout.setContext(getContext());
    layout.start();
    return layout;
  }
View Full Code Here

  @Override
  protected Layout<ILoggingEvent> makeSubjectLayout(String subjectStr) {
    if(subjectStr == null) {
      subjectStr = DEFAULT_SUBJECT_PATTERN;
    }
    PatternLayout pl = new PatternLayout();
    pl.setContext(getContext());
    pl.setPattern(subjectStr);
    // we don't want a ThrowableInformationConverter appended
    // to the end of the converter chain
    // This fixes issue LBCLASSIC-67
    pl.setPostCompileProcessor(null);
    pl.start();
    return pl;
  }
View Full Code Here

    return pl;
  }


  protected PatternLayout makeNewToPatternLayout(String toPattern) {
    PatternLayout pl = new PatternLayout();
    pl.setPattern(toPattern+"%nopex");
    return pl;
  }
View Full Code Here

TOP

Related Classes of ch.qos.logback.classic.PatternLayout

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.