**测试程序是经常需要打印后台执行日志,判断问题 **
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
创建log4j.properties 导入
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### direct messages to file mylog.log ###
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=c:/mylog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.ppender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### set log levels - for more verbose logging change 'info' to 'debug' ###
本地配置文件启动添加(application.properties)
注:要看那个文件就第二行改那个路径
#log4j
log4j.rootLogger=info, stdout
logging.level.com.df.wechat=debug
logging.level.org.springframework=debug
结构
祝你幸福
送你一首歌:《遥远的你 (正式版)》 221小伙伴
附图:舍友给的摄影2