mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-10 12:26:16 -04:00
* update * update --------- Co-authored-by: Glavo <zjx001202@gmail.com>
This commit is contained in:
parent
af3719403d
commit
96471e3a92
@ -111,13 +111,14 @@ public final class Logger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onShutdown() {
|
private void onExit() {
|
||||||
|
shutdown();
|
||||||
try {
|
try {
|
||||||
loggerThread.join();
|
loggerThread.join();
|
||||||
} catch (InterruptedException ignored) {
|
} catch (InterruptedException ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
String caller = CLASS_NAME + ".onShutdown";
|
String caller = CLASS_NAME + ".onExit";
|
||||||
|
|
||||||
if (logRetention > 0 && logFile != null) {
|
if (logRetention > 0 && logFile != null) {
|
||||||
List<Pair<Path, int[]>> list = new ArrayList<>();
|
List<Pair<Path, int[]>> list = new ArrayList<>();
|
||||||
@ -258,7 +259,7 @@ public final class Logger {
|
|||||||
loggerThread.setName("HMCL Logger Thread");
|
loggerThread.setName("HMCL Logger Thread");
|
||||||
loggerThread.start();
|
loggerThread.start();
|
||||||
|
|
||||||
Thread cleanerThread = new Thread(this::onShutdown);
|
Thread cleanerThread = new Thread(this::onExit);
|
||||||
cleanerThread.setName("HMCL Logger Shutdown Hook");
|
cleanerThread.setName("HMCL Logger Shutdown Hook");
|
||||||
Runtime.getRuntime().addShutdownHook(cleanerThread);
|
Runtime.getRuntime().addShutdownHook(cleanerThread);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user