Package ch.qos.logback.core.rolling

Examples of ch.qos.logback.core.rolling.TimeBasedRollingPolicy


        assertInstanceOf(a, SlingRollingFileAppender.class);
        SlingRollingFileAppender sr = (SlingRollingFileAppender) a;

        assertInstanceOf(sr.getTriggeringPolicy(), TimeBasedRollingPolicy.class);

        TimeBasedRollingPolicy tbrp = (TimeBasedRollingPolicy) sr.getTriggeringPolicy();
        assertEquals(5, tbrp.getMaxHistory());
        assertEquals("target/foo.%d{yyyy-MM}", tbrp.getFileNamePattern());
    }
View Full Code Here


    expectedFilenameList.add(randomOutputDir + "z" + testId);

    RollingFileAppender<ILoggingEvent> rfa = (RollingFileAppender<ILoggingEvent>) root
            .getAppender("ROLLING");

    TimeBasedRollingPolicy tprp = (TimeBasedRollingPolicy<ILoggingEvent>) rfa
            .getTriggeringPolicy();
    TimeBasedFileNamingAndTriggeringPolicy tbnatp = tprp
            .getTimeBasedFileNamingAndTriggeringPolicy();

    String prefix = "Hello---";
    int runLength = 4;
    for (int i = 0; i < runLength; i++) {
View Full Code Here

    RollingFileAppender<ILoggingEvent> rfa = (RollingFileAppender<ILoggingEvent>) root
            .getAppender("ROLLING");

    statusChecker.assertIsErrorFree();

    TimeBasedRollingPolicy tprp = (TimeBasedRollingPolicy<ILoggingEvent>) rfa
            .getTriggeringPolicy();
    TimeBasedFileNamingAndTriggeringPolicy tbnatp = tprp
            .getTimeBasedFileNamingAndTriggeringPolicy();

    int timeIncrement = 1000 / approxWritesPerPeriod;
    int runLength = approxWritesPerPeriod * 3;
    for (int i = 0; i < runLength; i++) {
View Full Code Here

   
    rfa.setAppend(true);
    rfa.setPrudent(safetyMode);
    rfa.setContext(loggerContext);

    TimeBasedRollingPolicy tbrp = new TimeBasedRollingPolicy();
   
    tbrp.setContext(loggerContext);
    tbrp.setFileNamePattern(filename+"-%d{"+DATE_PATTERN+"}.log");
    tbrp.setParent(rfa);
    tbrp.start();
 
    rfa.setRollingPolicy(tbrp);

   
    rfa.start();
View Full Code Here

            String basePath = configurationService.getHome() + File.separator + "log" + File.separator;

            appender = new RollingFileAppender<>();
            ((RollingFileAppender)appender).setFile(basePath + ((LogFileOutput) output).getFileName());

            TimeBasedRollingPolicy policy = new TimeBasedRollingPolicy();
            policy.setContext(loggerContext);
            policy.setMaxHistory(((LogFileOutput) output).getKeepDays());
            policy.setFileNamePattern(basePath + ((LogFileOutput) output).getFileName() + ".%d{yyyy-MM-dd}.gz");
            policy.setParent((FileAppender) appender);
            policy.start();

            ((RollingFileAppender) appender).setRollingPolicy(policy);

            PatternLayoutEncoder pl = new PatternLayoutEncoder();
            pl.setContext(loggerContext);
View Full Code Here

    SizeAndTimeBasedFNATP sizeTimeBasedPolicy = new SizeAndTimeBasedFNATP();
    // the max file size before rolling to a new file
    sizeTimeBasedPolicy.setMaxFileSize(maxFileSize);
    sizeTimeBasedPolicy.setContext(loggerContext);
   
    TimeBasedRollingPolicy policy = new TimeBasedRollingPolicy();
    // set the filename pattern
    policy.setFileNamePattern(fileName);
    // the maximum number of backup files to keep around
    policy.setMaxHistory(maxBackupFiles);
    policy.setTimeBasedFileNamingAndTriggeringPolicy(sizeTimeBasedPolicy);
    policy.setContext(loggerContext);
   
    return policy;
  }
View Full Code Here

TOP

Related Classes of ch.qos.logback.core.rolling.TimeBasedRollingPolicy

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.