I am dealing with a commerical Java API that exposes only the following logging configuration:
cplex.setOut(OutputStream arg0);
I would like to have logging to two streams: a file and the console. Is it possible?
I am dealing with a commerical Java API that exposes only the following logging configuration:
cplex.setOut(OutputStream arg0);
I would like to have logging to two streams: a file and the console. Is it possible?
Write your own OutputStream implementation which delegates calls to the write
methods to two wrapped OutputStreams, one for the console and one for the file.
You can use a TeeOutputStream
from the Apache Commons IO library.
i believe it is.
I would user the apache commons io lib.
For example
FileOutputStream fos = ...;
TeeOutputStream brancher = TeeOutputStream(fos, System.out);
cplex.setOut(brancher);