So long, commons-logging, hello SLF4J
Logback Project
SLF4J 預設使用 Logback,需要下列 package
slf4j-api-*.jar
logback-classic-*.jar
logback-core-*.jar
若要使用 LOG4j 則使用下列 package
slf4j-api-*.jar
slf4j-log4j12-*.jar
log4j-*.jar
Main.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Main {
private final Logger logger = LoggerFactory.getLogger(Main.class);
public Main() {
logger.debug("Constructor {}", new java.util.Date());
}
public static void main(String[] args) {
Main main = new Main();
}
}
沒有留言:
張貼留言