How to prevent a log from exiting from Apache Commons Exec

I am using Apache Commons Exec in a web application in JBoss 4.2.3. Whenever I call Apache Exec, it prints all the console output to the log, and this is a lot of output, and it can easily populate my logs in a production environment. How can I prevent this log from printing and show only error logs?

Hi

+3
source share
3 answers

In the log4j.properties file for your web application, add a line that looks something like this:

log4j.logger.org.apache.commons.exec=ERROR
+6
source

stdout/stderr/stdin , . , , .

executor.setStreamHandler(new PumpStreamHandler(null, null, null));
+6

You can disable logging at the application server level. Just add to jboss-log4j.xmlthis line:

<category name="org.apache.commons.exec">
  <priority value="ERROR"/>
</category>
+2
source

Source: https://habr.com/ru/post/1795500/


All Articles