logback
原始配置配置 appender, 控制文件的滚动方式&#xff0c;日志的输出格式。class&#61;"ch.qos.logback.core.rolling.RollingFileAppender">${saipan.logger.home}/method_profiling.logclass&#61;"ch.qos.logback.core.rolling.TimeBasedRollingPolicy">${saipan.logger.home}/method_profiling.log.%d{yyyy-MM-dd}-%i7<timeBasedFileNamingAndTriggeringPolicyclass&#61;"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">1GB%d{HH:mm:ss} - %msg%n配置logger&#xff0c; 指向上面的appender
修改为如下的配置修改配置appender&#xff0c;class&#61;"ch.qos.logback.core.rolling.RollingFileAppender">${saipan.logger.home}/method_profiling.logclass&#61;"ch.qos.logback.core.rolling.TimeBasedRollingPolicy">${saipan.logger.home}/method_profiling.log.%d{yyyy-MM-dd}-%i7<timeBasedFileNamingAndTriggeringPolicyclass&#61;"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">1GB%d{HH:mm:ss} - %msg%n其次配置一个异步的append&#xff0c; 并指向上面的appenderclass&#61;"ch.qos.logback.classic.AsyncAppender">5120true配置logger&#xff0c; 指向异步的appender.
log4j
如果是使用org.apache.log4j.DailyRollingFileAppender 来配置&#xff0c;那你的配置可能是这样的的。class&#61;"org.apache.log4j.DailyRollingFileAppender">class&#61;"org.apache.log4j.PatternLayout">和logback一样&#xff0c;在logger和appender之间增加 AsyncAppender 配置。class&#61;"com.alibaba.common.logging.spi.log4j.DailyRollingFileAppender">class&#61;"org.apache.log4j.PatternLayout">class&#61;"org.apache.log4j.AsyncAppender">