为mybatis提供log4j.properties,让其在运行时在控制台同步显示日志信息
##define an appender named console
log4j.appender.console=org.apache.log4j.ConsoleAppender
#The Target value is System.out or System.err
log4j.appender.console.Target=System.out
#set the layout type of the apperder
log4j.appender.console.layout=org.apache.log4j.PatternLayout
#set the layout format pattern
log4j.appender.console.layout.ConversionPattern=[%-5p] %m%n
##define a logger
log4j.rootLogger=debug,console
#log4j.logger.com.sinojava.erp.dao.PermissionDao=trace,console
#log4j.logger.com.sinojava.erp.dao.RoleDao=trace,console
#log4j.logger.com.sinojava.erp.dao.RolePermissionRelationDao=trace,console
#log4j.logger.com.sinojava.erp.dao.UserDao=trace,console
此文件需要放在src文件夹中,并且命名为log4j.properties,满足这两个条件,项目在运行时会自动加载此文件,使其生效
如下为登录时显示内容: