I have a java program acting as a Network server. Thanks the the utility update-rc.d I have installed a service on a Debian / Unix server in order to have it running all the time without being connected during a SSH session.
Because my program is in java bytecode, and not a native unix executable, I have used the following tutorial to make it work as a daemon: java as a daemon service
The problem is that I don’t see the output of the program any more. I need to see the output of the program, as it shows a stack trace when an exception happens. How to redirect standard and error output streams to a log file ?
Alternative question: How to run the java program and have it continusly running even when I log out from SSH ?
You can wrap the app launch command into a shell script and redirect output there:
But I’d recommend to use some logging framework to gain more control over log files. Something like slf4j with logback or any other backend.
You can do this with screen:
Then after SSH login run
to resume screen session.