/** * Pipe output to the specified writer, including the command and return code. * * <p> * The method can be called multiple times to write to multiple writers. * Don't close the writer afterwards. * * @param w The writer to pipe to. * @return This object (for method chaining). */ public ProcBuilder logTo(Writer w) { return logTo(w, false); }
/** * Pipe output to the specified writer, including the command and return code. * * <p> * The method can be called multiple times to write to multiple writers. * Don't close the writer afterwards. * * @param w The writer to pipe to. * @return This object (for method chaining). */ public ProcBuilder logTo(Writer w) { return logTo(w, false); }
/** * Pipe output to the specified writer, including the command and return code. * * <p> * The method can be called multiple times to write to multiple writers. * Don't close the writer afterwards. * * @param w The writer to pipe to. * @return This object (for method chaining). */ public ProcBuilder logTo(Writer w) { return logTo(w, false); }
/** * Pipe output to the specified writer, including the command and return code. * The method can be called multiple times to write to multiple writers. * * @param level The log level. * @param logger The logger to log to. * @return This object (for method chaining). */ public ProcBuilder logTo(final Level level, final Logger logger) { if (logger.isLoggable(level)) { logTo(new StringWriter() { private boolean isClosed; // Prevents messages from being written twice. @Override /* Writer */ public void close() { if (! isClosed) logger.log(level, this.toString()); isClosed = true; } }, true); } return this; }
/** * Pipe output to the specified writer, including the command and return code. * The method can be called multiple times to write to multiple writers. * * @param level The log level. * @param logger The logger to log to. * @return This object (for method chaining). */ public ProcBuilder logTo(final Level level, final Logger logger) { if (logger.isLoggable(level)) { logTo(new StringWriter() { private boolean isClosed; // Prevents messages from being written twice. @Override /* Writer */ public void close() { if (! isClosed) logger.log(level, this.toString()); isClosed = true; } }, true); } return this; }
/** * Pipe output to the specified writer, including the command and return code. * The method can be called multiple times to write to multiple writers. * * @param level The log level. * @param logger The logger to log to. * @return This object (for method chaining). */ public ProcBuilder logTo(final Level level, final Logger logger) { if (logger.isLoggable(level)) { logTo(new StringWriter() { private boolean isClosed; // Prevents messages from being written twice. @Override /* Writer */ public void close() { if (! isClosed) logger.log(level, this.toString()); isClosed = true; } }, true); } return this; }