Hi Guys,
I have been having some strange results from my code to do with logging within an inner class...
I have this class:
public class ShutdownHook extends Thread {
public void run() {
try {
// Stop server.
log.info("Server SHUTDOWN: Unexporting all Remote Services...");
DataRMIServer.this.stop();
log.info("Server successfully stopped.");
} catch (BodgittScarperException bse) {
log.warning("Caught " + bse);
log.warning("Cannot stop server: JVM Halting");
}
}
and am using it with this line in the constructor of the server class:
// Add shutdown hook.
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
Sometimes the logging prints other times it does not... I suspect that the console is being disconnected from the program before the logging finishes, this happens also to the log file. I am not sure why or how to stop this happening... would anyone know or have any ideas as to how to keep the logging handlers available until the logging is finished.
Thank you for any help.
James.
[ May 09, 2005: Message edited by: James Turner ]
I have been having some strange results from my code to do with logging within an inner class...
I have this class:
public class ShutdownHook extends Thread {
public void run() {
try {
// Stop server.
log.info("Server SHUTDOWN: Unexporting all Remote Services...");
DataRMIServer.this.stop();
log.info("Server successfully stopped.");
} catch (BodgittScarperException bse) {
log.warning("Caught " + bse);
log.warning("Cannot stop server: JVM Halting");
}
}
and am using it with this line in the constructor of the server class:
// Add shutdown hook.
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
Sometimes the logging prints other times it does not... I suspect that the console is being disconnected from the program before the logging finishes, this happens also to the log file. I am not sure why or how to stop this happening... would anyone know or have any ideas as to how to keep the logging handlers available until the logging is finished.
Thank you for any help.
James.
[ May 09, 2005: Message edited by: James Turner ]