Is there a way to tell IntelliJ where to store the output info?
-
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?– MeoSep 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.– Leonardo ErasSep 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?– LineSep 28, 2022 at 15:35
-
Can store this in append mode, instead of clearing all logs on re-run?– Sakkeer HussainSep 6 at 2:59
4 Answers
- Go to Run/Debug Configuration
- Click the "Logs" tab
- Check the "Save console output to file" box and select the output directory.
- Apply/OK
Source: https://www.jetbrains.com/help/idea/setting-log-options.html
-
1Is 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
-
-
4It 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?– KushwahaSep 2, 2021 at 10:41
-
is is possible to make IDEA automatically rotate this file, say, after every run?– YarNov 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
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
:
Then enter the path and file name, e.g. with IntelliJ 2022.2.5:
-
1followed the instructions, but the file does not get created or written to 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.– t0r0XJun 13 at 20:36
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.
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.
Specify the path to the file. If the file does not exist, it will be created automatically upon the first write.
-
followed the instructions, but the file does not get created or written to May 25 at 21:33
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