Windows shutdown hook on java application run from a bat script

From addShutdownHook documentation: In rare circumstances the virtual machine may abort, that is, stop running without shutting down cleanly. This occurs when the virtual machine is terminated externally, for example with the SIGKILL signal on Unix or the TerminateProcess call on Microsoft Windows. So i think nothing to do here, unfortunately. CTRL-CLOSE signal in Windows … Read more

How to log within shutdown hooks with Log4j2?

As of 2.0-beta9 this is now configurable in xml <configuration … shutdownHook=”disable”> Considering its now disabled, I guess I need to manually shutdown the logging system at the end of my shutdown hook. However I couldn’t find a means thorough the external interface, only in the internal api import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.config.Configurator; import org.apache.logging.log4j.core.LoggerContext; … … Read more