feat: add rolling-log-slf4j
This commit is contained in:
parent
985c1e7f0b
commit
99bf301fe5
|
@ -34,12 +34,16 @@
|
||||||
<artifactId>log4j-api</artifactId>
|
<artifactId>log4j-api</artifactId>
|
||||||
<version>2.17.1</version>
|
<version>2.17.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-core</artifactId>
|
<artifactId>log4j-core</artifactId>
|
||||||
<version>2.17.1</version>
|
<version>2.17.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-slf4j-impl</artifactId>
|
||||||
|
<version>2.17.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,15 +1,20 @@
|
||||||
package de.swingbe.rollinglog;
|
package de.swingbe.rollinglog;
|
||||||
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(Main.class);
|
private static final Logger logger = LoggerFactory.getLogger(Main.class);
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
for (int i = 0; i < 2000; i++) {
|
for (int i = 0; i < 2000; i++) {
|
||||||
logger.info("This is the " + i + ". time I say 'Hello World'.");
|
logger.trace("TRACE: This is the " + i + ". time I say 'Hello World'.");
|
||||||
Thread.sleep(1);
|
logger.info("INFO: This is the " + i + ". time I say 'Hello World'.");
|
||||||
|
logger.debug("DEBUG: This is the " + i + ". time I say 'Hello World'.");
|
||||||
|
logger.warn("WARN: This is the " + i + ". time I say 'Hello World'.");
|
||||||
|
logger.error("ERROR: This is the " + i + ". time I say 'Hello World'.");
|
||||||
|
Thread.sleep(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue