日志配置,主要要配置三大项
1.父logger:即rootLogger
2.子logger: 控制一定范围内的日志输出,某个包或类
3. appender:日志输出的目的地,可以是控制台、文件等
logger的继承关系,additivity属性
使A类的日志输出到testA这个appender下,而且不叠加到父logger的日志中
log4j.logger.cn.hancloud.databus.A=DEBUG, testA
log4j.additivity.cn.hancloud.databus.A= false
hyserver
[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%msg] [%logger{0}.%M.%L] \n
utf-8
${LOG_PATH}/debug.log
${LOG_PATH}/debug/debug-%d{yyyy-MM-dd}.%i.log
${maxHistory}
${maxFileSize}
${totalSizeCap}
true
[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%msg] [%logger{0}.%M.%L] \n
utf-8
${LOG_PATH}/info.log
${LOG_PATH}/info/info-%d{yyyy-MM-dd}.%i.log
${maxHistory}
${maxFileSize}
${totalSizeCap}
true
[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%msg] [%logger{0}.%M.%L] \n
utf-8
info
${LOG_PATH}/error.log
${LOG_PATH}/error/error-%d{yyyy-MM-dd}.%i.log
${maxHistory}
${maxFileSize}
${totalSizeCap}
true
[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%msg] [%logger{0}.%M.%L] \n
utf-8
error
${CSV_PATH}/passinfo.csv
${CSV_PATH}/passinfo_%d{yyyy-MM-dd}.%i.csv
${maxHistory}
${maxFileSize}
${totalSizeCap}
true
%msg\n
utf-8
info
https://www.cnblogs.com/wchxj/p/8048165.html
https://www.cnblogs.com/lixuwu/p/5810912.html
https://www.cnblogs.com/lixuwu/p/5804793.html
https://blog.csdn.net/flysun3344/article/details/80555746