如果存在多个%d,则需要在不是作为分割时间的里面加上aux
<springProperty scope="context" name="appLogPath" source="appLogPath" defaultValue="/data/backup" /> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${appLogPath}/%d{yyyy-MM-dd,aux}/logFile.%d{yyyy-MM-dd_HH}.log</fileNamePattern> <maxHistory>30</maxHistory> </rollingPolicy> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>INFO</level> <level>ERROR</level> </filter> <encoder> <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}][%-5level]-[%thread][requestId:%X{requestId}][imei:%X{imei}][%logger][username:%X{userName}]-%msg %rootException %n</pattern> </encoder> </appender>
标签:分割,记录,MM,dd,yyyy,HH,requestId,imei,日志 From: https://www.cnblogs.com/qq376324789/p/16642886.html