Is it possible to redirect console output to a log file in IntelliJ like Eclipse?

UPDATE: this feature is available in IDEA 11.

Not possible in IDEA at the moment, I've submitted a new feature request. Feel free to vote.

A workaround could be implemented using wrapper class with main() method which will redirect stdout and stderr to files and then run the main class of your application.


In more recent versions of IntelliJ this is possible. Go to the "Logs" tab of a run configuration. There is a "Save console output to file option".

I'm on IntelliJ 13.1.3 but I think this feature has been around for a while.


Considering the scenario, where you want to capture the log obtained on console via System.out.println("log info") , you could import the following classes :

import java.io.FileOutputStream;
import java.io.PrintStream;

and set the output stream to a file like this:

System.setOut(new PrintStream(new FileOutputStream("log_file.txt")));

This will redirect all the text to the file named log_file.txt . You could also go through this tutorial. Hope this helps. :)