Example usage for weka.core Tee add

List of usage examples for weka.core Tee add

Introduction

In this page you can find the example usage for weka.core Tee add.

Prototype

public void add(PrintStream p, boolean timestamp) 

Source Link

Document

adds the given PrintStream to the list of streams, with NO prefix.

Usage

From source file:jjj.asap.sas.util.Job.java

License:Open Source License

/**
 * Init job/*ww  w.j av  a2s.co m*/
 */
private void init(final String jobName) {

    // job information
    final int jobNumber = getNextJobNumber(jobName);
    this.jobId = jobName + "-" + jobNumber;
    final String logFileName = getLogFile(this.jobId);

    // setup logging and console
    PrintStream log;
    try {
        log = new PrintStream(new FileOutputStream(logFileName), true);
    } catch (FileNotFoundException e) {
        throw new RuntimeException(logFileName, e);
    }

    Tee stdout = new Tee(System.out);
    stdout.add(log, true);
    System.setOut(stdout);

    Tee stderr = new Tee(System.err);
    stderr.add(log, true);
    System.setErr(stderr);
}