修复日志文件夹不存在时无法将日志写入文件的问题 (#2984)

This commit is contained in:
Glavo 2024-04-11 19:43:18 +08:00 committed by GitHub
parent 32f8ffad46
commit 4104ca082d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -210,6 +210,7 @@ public final class Logger {
if (logFolder != null) {
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH-mm-ss"));
try {
Files.createDirectories(logFolder);
for (int n = 0; ; n++) {
Path file = logFolder.resolve(time + (n == 0 ? "" : "." + n) + ".log").toAbsolutePath().normalize();
try {