* First test with log4j rolling appenders * small fix * Log4j rolling appender * First set up with rolling file on log4j 2 * Added logback code. * log4j2 more detailed example * log4j2 more detailed example * Improved names and examples * Fixed configurations * improved configs * formatted * Final fix * fixed formatting * Formatting fix * Fix sample apps to avoid try / catch * Fix request to replace files * Fix end lines
20 lines
491 B
Java
20 lines
491 B
Java
package com.baeldung.logback;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import java.util.stream.IntStream;
|
|
|
|
public class LogbackRollingExample {
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(LogbackRollingExample.class);
|
|
|
|
public static void main(String[] args) throws InterruptedException {
|
|
for(int i = 0; i<2000; i++){
|
|
logger.info("This is the {} time I say 'Hello World'.", i);
|
|
Thread.sleep(100);
|
|
}
|
|
}
|
|
|
|
}
|