Forums Register Login

Inner Classes and logging...

+Pie Number of slices to send: Send
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 ]
Shiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 638 times.
Similar Threads
Annotations are not recognised
Advice on simple threadding...
log entries with java logging
server gui ? and safe shutdown
Logger / ShutdownHook
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:37:37.