My application is allowed to have multiple instances running and I would like to log events from all running instances. I am currently using java util logging’s socket handler to centralize the logging process. When the first instance starts, it also a starts a new socket server thread. The problem is when this instance is closed, the server thread is also closed and log method (from another instance) throws exception. I am not thinking to run it as a separate process (using Runtime exec) because I would not be able to shut it down gracefully from my application.
So is there a way where another instance on seeing the server down, create a new server thread? This similar approach is being done in H2 database AUTO_SERVER mode where it automatically switches to client and server mode.
So any suggestions on how to do this?
I ended up using Logback’s prudent mode.