Skip to main content
deleted 28 characters in body
Source Link

Here's an example of TeeOutputStream usage (keep outputting stdout & stderr) and printing it to file:

public static void main(String[] args) throws IOException {

    System.setOut(new PrintStream(new TeeOutputStream(System.out, new PrintStream("boc-badge-manager"out.log"))));
    System.setErr(new PrintStream(new TeeOutputStream(System.err, new PrintStream("boc-badge-manager"err.log"))));
...

Here's an example of TeeOutputStream usage (keep outputting stdout & stderr) and printing it to file:

public static void main(String[] args) throws IOException {

    System.setOut(new PrintStream(new TeeOutputStream(System.out, new PrintStream("boc-badge-manager.log"))));
    System.setErr(new PrintStream(new TeeOutputStream(System.err, new PrintStream("boc-badge-manager.log"))));
...

Here's an example of TeeOutputStream usage (keep outputting stdout & stderr) and printing it to file:

public static void main(String[] args) throws IOException {

    System.setOut(new PrintStream(new TeeOutputStream(System.out, new PrintStream("out.log"))));
    System.setErr(new PrintStream(new TeeOutputStream(System.err, new PrintStream("err.log"))));
...
Source Link

Here's an example of TeeOutputStream usage (keep outputting stdout & stderr) and printing it to file:

public static void main(String[] args) throws IOException {

    System.setOut(new PrintStream(new TeeOutputStream(System.out, new PrintStream("boc-badge-manager.log"))));
    System.setErr(new PrintStream(new TeeOutputStream(System.err, new PrintStream("boc-badge-manager.log"))));
...