/** * The stream to write traces to. * * @return OutputStream */ public OutputStream getOutputStream() { return new LogOutputStream(XSLTProcess.this); } }
/** * Creates log stream handler * * @param pc the project component for whom to log * @param outlevel the loglevel used to log standard output * @param errlevel the loglevel used to log standard error */ public LogStreamHandler(ProjectComponent pc, int outlevel, int errlevel) { super(new LogOutputStream(pc, outlevel), new LogOutputStream(pc, errlevel)); }
/** * Create a new LogOutputResource. * @param managingComponent ditto */ public LogOutputResource(ProjectComponent managingComponent) { super(NAME); outputStream = new LogOutputStream(managingComponent); }
/** * Create a new LogOutputResource. * @param managingComponent owning log content * @param level log level */ public LogOutputResource(ProjectComponent managingComponent, int level) { super(NAME); outputStream = new LogOutputStream(managingComponent, level); }
public TestNGLogSH(Task task, int outlevel, int errlevel, boolean verbose) { super(new TestNGLogOS(task, outlevel, verbose), new LogOutputStream(task, errlevel)); } }
/** * Creates default logger. * @param task the task to possibly log to * @return a DefaultLogger instance * @throws IOException if an error occurs */ private AuditListener createDefaultLogger(Task task) throws IOException { final AuditListener defaultLogger; if (toFile == null || !useFile) { defaultLogger = new DefaultLogger( new LogOutputStream(task, Project.MSG_DEBUG), AutomaticBean.OutputStreamOptions.CLOSE, new LogOutputStream(task, Project.MSG_ERR), AutomaticBean.OutputStreamOptions.CLOSE ); } else { final OutputStream infoStream = Files.newOutputStream(toFile.toPath()); defaultLogger = new DefaultLogger(infoStream, AutomaticBean.OutputStreamOptions.CLOSE, infoStream, AutomaticBean.OutputStreamOptions.NONE); } return defaultLogger; }
/** * Creates XML logger. * @param task the task to possibly log to * @return an XMLLogger instance * @throws IOException if an error occurs */ private AuditListener createXmlLogger(Task task) throws IOException { final AuditListener xmlLogger; if (toFile == null || !useFile) { xmlLogger = new XMLLogger(new LogOutputStream(task, Project.MSG_INFO), AutomaticBean.OutputStreamOptions.CLOSE); } else { xmlLogger = new XMLLogger(Files.newOutputStream(toFile.toPath()), AutomaticBean.OutputStreamOptions.CLOSE); } return xmlLogger; }
public TestNGLogSH(Task task, int outlevel, int errlevel, boolean verbose) { super(new TestNGLogOS(task, outlevel, verbose), new LogOutputStream(task, errlevel)); } }
/** * Return the list of listeners set in this task. * @return the list of listeners. */ private AuditListener[] getListeners() { final int formatterCount = Math.max(1, formatters.size()); final AuditListener[] listeners = new AuditListener[formatterCount]; // formatters try { if (formatters.isEmpty()) { final OutputStream debug = new LogOutputStream(this, Project.MSG_DEBUG); final OutputStream err = new LogOutputStream(this, Project.MSG_ERR); listeners[0] = new DefaultLogger(debug, AutomaticBean.OutputStreamOptions.CLOSE, err, AutomaticBean.OutputStreamOptions.CLOSE); } else { for (int i = 0; i < formatterCount; i++) { final Formatter formatter = formatters.get(i); listeners[i] = formatter.createListener(this); } } } catch (IOException ex) { throw new BuildException(String.format(Locale.ROOT, "Unable to create listeners: " + "formatters {%s}.", formatters), ex); } return listeners; }
private OutputStream createOutputStream() throws IOException { if (destfile == null) { return new LogOutputStream(this); } if (destfile.exists() && destfile.isDirectory()) { String message = "destfile is a directory!"; if (failonerror) { throw new BuildException(message, getLocation()); } log(message, Project.MSG_ERR); return null; } if (destfile.exists() && !destfile.canWrite()) { String message = "Can not write to the specified destfile!"; if (failonerror) { throw new BuildException(message, getLocation()); } log(message, Project.MSG_ERR); return null; } return Files.newOutputStream(this.destfile.toPath()); }
/** * access the stream to which the stderr from cvs should go * if this stream has already been set, it will be returned * if the stream has not yet been set, if the attribute error * has been set, the output stream will go to the file denoted by the error attribute * otherwise the stderr output will go to ant's logging system * @return output stream to which cvs' stderr should go to */ protected OutputStream getErrorStream() { if (this.errorStream == null) { if (error != null) { try { setErrorStream(new PrintStream( new BufferedOutputStream( FileUtils.newOutputStream(Paths.get(error.getPath()), append)))); } catch (IOException e) { throw new BuildException(e, getLocation()); } } else { setErrorStream(new LogOutputStream(this, Project.MSG_WARN)); } } return this.errorStream; }
/** * access the stream to which the stdout from cvs should go * if this stream has already been set, it will be returned * if the stream has not yet been set, if the attribute output * has been set, the output stream will go to the output file * otherwise the output will go to ant's logging system * @return output stream to which cvs' stdout should go to */ protected OutputStream getOutputStream() { if (this.outputStream == null) { if (output != null) { try { setOutputStream(new PrintStream( new BufferedOutputStream( FileUtils.newOutputStream(Paths.get(output.getPath()), append)))); } catch (IOException e) { throw new BuildException(e, getLocation()); } } else { setOutputStream(new LogOutputStream(this, Project.MSG_INFO)); } } return this.outputStream; }
new LogOutputStream(this, Project.MSG_INFO)), "listing properties"); } catch (IOException ex) { log("failed to log unshortened properties"); lnks.list(new PrintStream( new LogOutputStream(this, Project.MSG_INFO)));
Commandline cmd = setupJavacCommand(true); OutputStream logstr = new LogOutputStream(attributes, Project.MSG_WARN); try {
/** * Execute the task. */ public void execute() { DOMElementWriter writer = new DOMElementWriter(!append, namespacePolicy.getPolicy()); OutputStream os = null; try { if (file != null) { os = FileUtils.newOutputStream(file.toPath(), append); } else { os = new LogOutputStream(this, Project.MSG_INFO); } Node n = getFragment().getFirstChild(); if (n == null) { throw new BuildException(ERROR_NO_XML); } writer.write((Element) n, os); } catch (BuildException e) { throw e; } catch (Exception e) { throw new BuildException(e); } finally { FileUtils.close(os); } }
new LogOutputStream(getRmic(), Project.MSG_WARN);
/** * Execute the length task. */ @Override public void execute() { validate(); OutputStream out = property == null ? new LogOutputStream(this, Project.MSG_INFO) : new PropertyOutputStream(getProject(), property); PrintStream ps = new PrintStream(out); switch (mode) { case STRING: ps.print(getLength(string, getTrim())); ps.close(); break; case EACH: handleResources(new EachHandler(ps)); break; case ALL: handleResources(new AllHandler(ps)); break; } }
LogOutputStream outLog = new LogOutputStream(this, Project.MSG_VERBOSE); LogOutputStream errLog = new LogOutputStream(this, Project.MSG_ERR); StreamPumper outPump = new StreamPumper(p.getInputStream(), outLog); StreamPumper errPump = new StreamPumper(p.getErrorStream(), errLog);
outputstream = new LogOutputStream(this, Project.MSG_INFO); } else { outputstream = new LogOutputStream(this, Project.MSG_DEBUG); errorstream = new LogOutputStream(this, Project.MSG_WARN); } else { errorstream = new LogOutputStream(this, Project.MSG_DEBUG);
try { result = runCmd(commandLine, new PumpStreamHandler(fos, new LogOutputStream(this, Project.MSG_WARN))); } finally { FileUtils.close(fos);