Kill the >/dev/null 2>&1!

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.