35

Is there a way to tell IntelliJ where to store the output info?

4
  • Are you making an IntelliJ plugin? And you know how to store the output, but just need to get a project path? Why don't you just use a logback?
    – Meo
    Sep 25, 2017 at 20:22
  • The plugin will be used by students in the laboratory. After project loading, they are requested their student ID, so a new folder can be created for student. There I want to save the console output of whatever they are programming in IntelliJ. Sep 29, 2017 at 17:32
  • Does this answer your question? Is it possible to redirect console output to a log file in IntelliJ like Eclipse?
    – Line
    Sep 28, 2022 at 15:35
  • Can store this in append mode, instead of clearing all logs on re-run? Sep 6 at 2:59

4 Answers 4

45
  1. Go to Run/Debug Configuration
  2. Click the "Logs" tab
  3. Check the "Save console output to file" box and select the output directory.
  4. Apply/OK

Source: https://www.jetbrains.com/help/idea/setting-log-options.html

5
  • 1
    Is there a way to change it programming? I'm not going to use the plugin, some students are, and I don't know about their machines, I just want it to be saved in the same path as their projects Sep 25, 2017 at 17:17
  • 4
    It didn't work, through server console in intellij game message that "console output is saving to = (folder name) but still its not creating log file. Am i missing something?
    – Kushwaha
    Sep 2, 2021 at 10:41
  • is is possible to make IDEA automatically rotate this file, say, after every run?
    – Yar
    Nov 3, 2021 at 15:28
  • @Kushwaha You need to save the run configuration. If it is not saved is greyed out. It should be left to the run button (containing your script name). Click on your script name and select save in the dropdown menu. Jul 17, 2022 at 14:03
9

In newer IntelliJ editions, starting with ~ year 2020, the setting has again visually moved. In addition to answer from @ahmednabil88:

In Run/Debug Configurations dialog: add Modify options > Logs > Save console output to file:

Screenshot of how to add log filie in "Run Configuration" parameters

Then enter the path and file name, e.g. with IntelliJ 2022.2.5: Example of log file

2
  • 1
    followed the instructions, but the file does not get created or written to
    – Tim Boland
    May 25 at 21:33
  • @TimBoland I just tested this with IntelliJ 2022.2.5 and it worked. Have you supplied a filename with path? I'll add another screenshot illustrating my configuration.
    – t0r0X
    Jun 13 at 20:36
7

Official UPDATE from IntelliJ help page:
For the New appearance

Save console output to a file
If you use console output for logging, you can save it to a file for later inspection.

  1. In the run/debug configuration that will be used for launching the app, click Modify options. From the menu, select Save console output to file.

  2. Specify the path to the file. If the file does not exist, it will be created automatically upon the first write.

1
  • followed the instructions, but the file does not get created or written to
    – Tim Boland
    May 25 at 21:33
1

Please note that at some point in 2018, this feature stopped working properly in IntelliJ for a number of users. As earlier answers to this question have indicated, IntelliJ's own documentation shows that it should be possible to write logs to a file.

There was a bug report filed with IntelliJ in 2018 that has still not been fixed. If you really need this feature, vote for it here to increase the chances that it gets fixed: https://youtrack.jetbrains.com/issue/IDEA-194934

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.