3

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

Regards

skaffman
  • 398,947
  • 96
  • 818
  • 769
Alex
  • 616
  • 1
  • 12
  • 28

3 Answers3

7

You can also disable the stdout/stderr/stdin streams from the process by supplying it null streams. This way you don't need to fiddle with the logging levels if you really have no use for the output.

executor.setStreamHandler(new PumpStreamHandler(null, null, null));
vehnae
  • 666
  • 8
  • 5
6

In your log4j.properties file for your web app add a line that looks something like this following...

log4j.logger.org.apache.commons.exec=ERROR
Andrew White
  • 52,720
  • 19
  • 113
  • 137
2

You can disable logging on application server level. Just add to jboss-log4j.xml such line:

<category name="org.apache.commons.exec">
  <priority value="ERROR"/>
</category>
Lukasz Stelmach
  • 5,281
  • 4
  • 25
  • 29