I know that log4j by default outputs to stderror.
I have been capturing the out put of my application with the following command:
application_to_run 2> log ; cat log | grep FATAL
Is there a way to capture the output without the auxiliary file?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want both
stdoutandstderr, use:If you want both
stderralone, you can use:The first sends all output destined for file handle 2 (
stderr) to file handle 1 (stdout), then pipes that throughgrep. The second does the same but also sendsstdoutto the bit bucket. This will work since redirection is a positional thing. First,stderris redirected to the currentstdout, thenstdoutis redirected to/dev/null.