How to output logs from a Shell Script launched within Java in a log4j RollingFileAppender?
问题 I have a Java Webapplication running on Tomcat, executing Shell scripts at runtime in which many "echo" commands are executed. My problem is that I'd like all my logs to appear in a log4j RollingFileAppender, ie: Java Log4j logs (which is easy to do) Shell echo commands logs as well (which is the tricky part to me) The Shell scripts are run via java.lang.Process class. So far, I've managed to output the inputStream and errorStream of the process to System.out thanks to the log4j-provided