Junjie
7 小时以前 8bfe1168a42d4e3750a15b0c0fb0a7629d6cf91c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.zy.system.timer;
 
import com.zy.system.service.LogCleanupService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
@Slf4j
@Component
public class LogCleanupScheduler {
 
    @Autowired
    private LogCleanupService logCleanupService;
 
    @Scheduled(cron = "0 0 23 * * ?")
    public void cleanupExpiredLogs() {
        try {
            logCleanupService.cleanupScheduled();
        } catch (Exception ex) {
            log.error("日志流水自动清理失败", ex);
        }
    }
}