mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 08:42:32 -08:00
feat: log file size limiter
This commit is contained in:
1 parent
2185eb6a35
commit
11ef2c13a8
1 file changed
+5
-4
@@ -27,10 +27,11 @@ public class LogManager {
|
||||
if (mainLogDir != null) {
|
||||
if (!mainLogDir.exists())
|
||||
mainLogDir.mkdirs();
|
||||
File lastLogFile = new File(mainLogDir, "log_last.log");
|
||||
if (lastLogFile.exists())
|
||||
lastLogFile.delete();
|
||||
FileHandler filehandler = new FileHandler(lastLogFile.getPath(), true);
|
||||
for (File f : mainLogDir.listFiles()) {
|
||||
if (f.getName().startsWith("log_last"))
|
||||
f.delete();
|
||||
}
|
||||
FileHandler filehandler = new FileHandler("log_last_%g.log", 25 * 1000000, 2);
|
||||
filehandler.setFormatter(loc);
|
||||
global.addHandler(filehandler);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user