由 apache 推出的开源免费日志处理的类库.
<!-- log4j 日志 -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
log4j.properties
路径和名称都不允许改变
log4j.rootCategory=DEBUG, CONSOLE, LOGFILE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n %C %d %L%n
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=D:/myLog.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=- %m%n %C %d %L%n
Logger logger = Logger.getLogger(Test.class);
logger.debug("这是一个调试信息");
logger.info("这是一个info信息");
logger.info(log.getAccOut() + "给" + log.getAccIn() + "在" + new Date().toLocaleString() + "转了"+ log.getMoney());
fatal
(致命错误) > error
(错误) > warn
(警告) > info
(普通信息) > debug
(调试信息)log4j.rootCategory=DEBUG, CONSOLE, LOGFILE
log4j.rootCategory=INFO, CONSOLE,LOGFILE
log4j.logger.a.b=DEBUG
log4j.logger.a=DEBUG
<mapper namespace="com.mapper">
<select id="selByPage" resultType="People" parameterType="map">
select * from people limit #{pageStart},#{pageSize}
</select>
<select id="selCount" resultType="long">
select count(*) from people
</select>
</mapper>
log4j.logger.com = DEBUG
log4j.logger.com.mapper = DEBUG
log4j.logger.com.mapper.selByPage = DEBUG
package com.mapper;
public interface StudentMapper {
@Select("select t.id `teacher.id`,t.name`teacher.name`,s.id id,s.name name, age,tid from student s left join teacher t on t.id=s.tid")
List<Student> selAll();
}
log4j.logger.com.mapper = DEBUG
log4j.logger.com.mapper.StudentMapper = DEBUG
log4j.logger.com.mapper.StudentMapper.selAll = DEBUG