Apache's Common logging is a high-level log framework that does not achieve true write logging, but relies on other log systems such as the java.util.logging of the Java itself. You can set the final use log4j or java.util.logging by the configuration file. The default is java.utl.logging, if you want to use log4j, you need to make some configuration, divide 3 steps, 1. Create log4j configuration file, such as log4j.proiperties: log4j.rootlogger = debug, a1 log4j.appender.a1 = Org.apache.log4j.consoleappender log4j.Appender.a1.Layout = org.apache.log4j.patternLayout log4j.Appender.a1.Layout.conversionPattern =% - 4R% -5P [% t]% 37C% 3X -% M % N These configurations make the log4j to output LOG information to the Console. For details on log4j, please refer to the Log4j documentation of Apache. 2. Establish commons-logging configuration file, commons-logging.properties: org.apache.commons.logging.LogFactory = org.apache.commons.logging.impl.Log4jFactory org.apache.commons.logging.impl.Log4jFactory is commons -logging For a logfactory derived class implemented by Log4j. 3. Write on the code: log log = logfactory.getlog (...); then you can write log information directly, such as log.debug ("...") log.error ("..." "); ... Note: Both of these configuration files must be under ClassPath.