Package ch.qos.logback.classic

Examples of ch.qos.logback.classic.AsyncAppender


    protected Appender<ILoggingEvent> wrapAsync(Appender<ILoggingEvent> appender) {
        return wrapAsync(appender, appender.getContext());
    }

    protected Appender<ILoggingEvent> wrapAsync(Appender<ILoggingEvent> appender, Context context) {
        final AsyncAppender asyncAppender = new AsyncAppender();
        asyncAppender.setQueueSize(queueSize);
        asyncAppender.setDiscardingThreshold(discardingThreshold);
        asyncAppender.setContext(context);
        asyncAppender.setName("async-" + appender.getName());
        asyncAppender.addAppender(appender);
        asyncAppender.start();
        return asyncAppender;
    }
View Full Code Here


                .contains("%pid");
    }

    @Test
    public void patternIncludesAppNameAndPid() throws Exception {
        final AsyncAppender wrapper = (AsyncAppender) new SyslogAppenderFactory()
                .build(new LoggerContext(), "MyApplication", null);
        assertThat(((SyslogAppender) wrapper.getAppender("syslog-appender")).getSuffixPattern())
                .matches("^MyApplication\\[\\d+\\].+");
    }
View Full Code Here

    @Test
    public void stackTracePatternCanBeSet() throws Exception {
        final SyslogAppenderFactory syslogAppenderFactory = new SyslogAppenderFactory();
        syslogAppenderFactory.setStackTracePrefix("--->");
        final AsyncAppender wrapper = (AsyncAppender) syslogAppenderFactory
                .build(new LoggerContext(), "MyApplication", null);
        assertThat(((SyslogAppender) wrapper.getAppender("syslog-appender"))
                .getStackTracePattern()).isEqualTo("--->");
    }
View Full Code Here

  @Inject
  public AsyncLogAppender(@Named(LoggingConfiguration.SYNC_LOG_APPENDER_ANNOTATION) LogAppender logAppender) {
    this.logAppender = logAppender;

    this.asyncAppender = new AsyncAppender();
    asyncAppender.setIncludeCallerData(true);
    asyncAppender.setQueueSize(1000);
    asyncAppender.setDiscardingThreshold(0);
    asyncAppender.setName("async-" + logAppender.getName());
  }
View Full Code Here

TOP

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

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.