Adjust logback graceful close

This commit is contained in:
carbotaniuman 2020-06-19 15:37:21 -05:00
parent 5e407a9e81
commit f02c47ca1f
2 changed files with 4 additions and 3 deletions

View file

@ -1,5 +1,6 @@
package mdnet.base; package mdnet.base;
import ch.qos.logback.classic.LoggerContext;
import mdnet.base.settings.ClientSettings; import mdnet.base.settings.ClientSettings;
import mdnet.base.server.ApplicationKt; import mdnet.base.server.ApplicationKt;
import mdnet.base.server.WebUiKt; import mdnet.base.server.WebUiKt;
@ -262,10 +263,12 @@ public class MangaDexClient {
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("Cache failed to close", e); LOGGER.error("Cache failed to close", e);
} }
executorService.shutdown();
readyToExit.set(true); readyToExit.set(true);
}; };
while (!readyToExit.get()) { while (!readyToExit.get()) {
} }
executorService.shutdown();
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
loggerContext.stop();
} }
} }

View file

@ -1,6 +1,4 @@
<configuration> <configuration>
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<immediateFlush>false</immediateFlush> <immediateFlush>false</immediateFlush>