application-shutdown

Application.Current.Shutdown(-1) not closing WPF app

筅森魡賤 提交于 2019-11-28 04:31:06
问题 I am checking if the windows authenticated user is a valid user for my wpf application or not. If not, I need to shut down the application; but even after executing Application.Current.Shutdown(-1) the application keeps on executing happily. The below link says that I need to remove my StartUpURI; but I dont have that tag in my app.xaml. -> Shutting down a WPF application from App.xaml.cs EDIT :- I have this code in APP.XAML.CS -> protected override void OnStartup(StartupEventArgs e) { base

How to properly shutdown log4j2

折月煮酒 提交于 2019-11-27 23:38:04
If one is not running inside a web application, what is the proper way to shutdown Log4j2? I only see a noop LogManager.shutdown() There is no public API for this, but you can use ((LifeCycle) LogManager.getContext()).stop(); If you have an interest in having a public API for this, please vote for or add a comment here: https://issues.apache.org/jira/browse/LOG4J2-124 Update: In Log4j 2.5 you can call Configurator.shutdown() . With Log4j 2.6 you can call LogManager.shutdown() . Explanation and story behind What Log4j 2 use internally is what they call a ShutdownRegistrationStrategy . It

Windows shutdown hook on java application run from a bat script

ε祈祈猫儿з 提交于 2019-11-27 13:14:47
I have a bat script which runs a java application. If I press ctrl+c on it, it the application terminates gracefully, invoking all the shutdown hooks. However, if I just close the cmd window of the bat script, the shutdown hooks are never invoked. Is there a way to solve this? Perhaps there's a way to tell the bat script how to terminate the invoked applications when its window is closed? 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

Shutting down a WPF application from App.xaml.cs

假装没事ソ 提交于 2019-11-27 01:34:38
问题 I am currently writing a WPF application which does command-line argument handling in App.xaml.cs (which is necessary because the Startup event seems to be the recommended way of getting at those arguments). Based on the arguments I want to exit the program at that point already which, as far as I know, should be done in WPF with Application.Current.Shutdown() or in this case (as I am in the current application object) probably also just this.Shutdown() . The only problem is that this doesn't

How to properly shutdown log4j2

你。 提交于 2019-11-26 21:32:25
问题 If one is not running inside a web application, what is the proper way to shutdown Log4j2? I only see a noop LogManager.shutdown() 回答1: There is no public API for this, but you can use ((LifeCycle) LogManager.getContext()).stop(); If you have an interest in having a public API for this, please vote for or add a comment here: https://issues.apache.org/jira/browse/LOG4J2-124 Update: In Log4j 2.5 you can call Configurator.shutdown() . With Log4j 2.6 you can call LogManager.shutdown() . 回答2: