Output history in IntelliJ IDEA

已回答

Hi!

In my code I log useful information to system output using the following JAVA method: System.out.println(...).
Is it possible in IntelliJ IDEA to find a history of information that I wrote to output?

1
Avatar
Permanently deleted user

Console output is not retained between runs. It is one of the inherit shortcomings of console output. You need to use a logging framework in order to retain output between runs. (IDEA can display the output of a log in a tab in the run window if desired.) For a quick hit, you may want to look at the System Out and Err Redirected to SLF4J project that allows, with a single line of code (plus a log config file), all console output to be redirected to a Simple Logging Façade for Java (SLF4J) logger such as Logback. But in general, you'll find it most beneficial to switch to using a logging framework rather than System.out.

0
Avatar
Permanently deleted user

One note - it's possible to keep output console within the same ide session. You can just pin it (see below) and it will be preserved:


pin.png
Denis

2
Avatar
Permanently deleted user

Pinning console saves output!

0

Unfortunately in recent version of IntelliJ pinning the console has no effect.

After the program has exit the console output is directly discarded :(

0

jp_java Sorry, can't reproduce. What specific console are you referring to? Please share a sample project or a video of the issue at https://uploads.jetbrains.com.

0

请先登录再写评论。