log4j.properties

 1 #将等级为DEBUG的日志信息输出到console和file这两个目的地,console和file的定义在下面的代码
 2 log4j.rootLogger=DEBUG,console,file
 3 #控制台输出的相关设置
 4 log4j.appender.console = org.apache.log4j.ConsoleAppender
 5 log4j.appender.console.Target = System.out
 6 log4j.appender.console.Threshold=DEBUG
 7 log4j.appender.console.layout = org.apache.log4j.PatternLayout
 8 log4j.appender.console.layout.ConversionPattern=[%c]-%m%n
 9 #文件输出的相关设置
10 log4j.appender.file = org.apache.log4j.RollingFileAppender
11 log4j.appender.file.File=./log/reliable.log
12 log4j.appender.file.MaxFileSize=10mb
13 log4j.appender.file.Threshold=DEBUG
14 log4j.appender.file.layout=org.apache.log4j.PatternLayout
15 log4j.appender.file.layout.ConversionPattern=[%p][%d{yy-MM-dd}][%c]%m%n
16 #日志输出级别
17 log4j.logger.org.mybatis=DEBUG
18 log4j.logger.java.sql=DEBUG
19 log4j.logger.java.sql.Statement=DEBUG
20 log4j.logger.java.sql.ResultSet=DEBUG
21 log4j.logger.java.sql.PreparedStatement=DEBUG

 

1     <dependency>
2       <groupId>log4j</groupId>
3       <artifactId>log4j</artifactId>
4       <version>1.2.17</version>
5     </dependency>

 

posted @ 2022-03-31 16:36  靠谱杨  阅读(36)  评论(0编辑  收藏  举报