Commons Logging
/App01/src/jp/sample/myapp/App01.java
package jp.sample.myapp;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class App01 {
public static void main(String[] args) {
Log log = LogFactory.getLog(App01.class);
log.debug("DEBUG: DEBUG");
log.fatal("DEBUG: FATAL");
log.info( "DEBUG: INFO");
}
}
/App01/src/log4j.properties
log4j.rootLogger=INFO,myconsole
log4j.appender.myconsole=org.apache.log4j.ConsoleAppender
log4j.appender.myconsole.Target=System.out
log4j.appender.myconsole.layout=org.apache.log4j.PatternLayout
log4j.appender.myconsole.layout.ConversionPattern=%d [%t] %-5p %c(%L) - %m%n
/App01/src/commons-logging.properties
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
参考