Almost all of our Java applications in the project group (not dependent on Tomcat) are started with this command:
nohup java-server $JAVA _opts-classpath $CORE _classpath com .jd .chat .core >/dev/null 2 >&1 &
That is to say, all the logs of the application will be output to the/dev/null, which is plainly absorbed by the black hole.
Start an application today, observe the application of the log4j log, found that half of the hit, no error, no output to start a successful log, there is no output failed to start the log. Just stop there, check the Java process it's still alive. But the process is completely out of the ordinary. restarted n times or not!
The guessing process starts with an error, but does not hit the specified log file by log4j. Open the startup script and kill the/dev/null 2>&1. Re-boot! log output directly to the monitor , and sure enough, a classnotfound fatal error was played! After this exception log is resolved, the app starts successfully.
If one day, your app is also dead, log4j does not show the Exception log, you can try to do so.
The effect of killing this command is to: all logs generated by the app will be called out! The log4j configuration is likely to filter out some vital logs.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Kill the >/dev/null 2>&1!