1

I want tracing to appear in my java console when I set a non-zero trace level. i.e. Java's equivalent of C#'s

Trace.WriteLine("hello");

Is there anything available like that? Can I get at "deployment.trace" at runtime? Is there an environment variable I can check?

Nimantha
  • 6,405
  • 6
  • 28
  • 69
timB33
  • 1,977
  • 16
  • 33

1 Answers1

1

The answer is already in this link, but to summarize the answer it's like this:

PrintStream out = new PrintStream(new FileOutputStream("outputfile.txt"));
System.setOut(out);

After the line System.setOut(out); anything will be written in the file instead of the console.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
ibr
  • 319
  • 1
  • 5
  • 19