Package org.apache.commons.exec

Examples of org.apache.commons.exec.LogOutputStream


  public ScriptExecutor() {
   
    outBuilder = new StringBuilder();
    errBuilder = new StringBuilder();
   
    errStream = new LogOutputStream() {
      @Override
      protected void processLine(String line, int level) {
        if (!line.isEmpty()) {
          errBuilder.append(line + "\n");
          for (ExecutionResponseListener listener : listeners) {
            listener.executionMessage(line);
          }
        }
      }
    };
   
    outStream = new LogOutputStream() {
      @Override
      protected void processLine(String line, int level) {
        if (!line.isEmpty()) {
          outBuilder.append(line + "\n");
          for (ExecutionResponseListener listener : listeners) {
View Full Code Here


        CommandLine command = CommandLine.parse(execCommand);
       
        out.println("========================");
        info(out, String.format("Execute command: %s",  command.toString()));
        out.println("========================");
        LogOutputStream outputStream = new LogOutputStream() {
            protected void processLine(String line, int level){
                log.info(String.format("Command logged an out: %s", line));
                out.println(line);
            }
        };
        LogOutputStream errorStream = new LogOutputStream() {
            protected void processLine(String line, int level){
                log.error(String.format("Command logged an error: %s", line));
                out.println(line);
            }
        };
View Full Code Here

        //err and out are redirected to out
        if (!_redirectToLog) {
          exec.setStreamHandler(new PumpStreamHandler(System.out, System.err, System.in));
        } else {
            exec.setStreamHandler(new PumpStreamHandler(new LogOutputStream() {
                private LevelState _previous = new LevelState();
               
                @Override
                protected void processLine(String line, int level) {
                  try {
View Full Code Here

TOP

Related Classes of org.apache.commons.exec.LogOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.