This article is primarily for Windows users. I do not know how to adapt this for macOS or Linux.
The rationale for all of this is that when you install some new mods or update existing ones you want to quickly be able to identify any problems. This applies to both manual installs (improperly copying files, etc) and automated CKAN installs (new or as yet uncovered bugs in the mod itself). This means that you have to adopt this procedure from day one so you don’t get hit with a wall of several hundred or yes even thousand ERRs and WRNs with some EXC thrown in as well that you need to parse through. It’s a bit labor intensive at the beginning but saves you time in the long run.
Go through 2-5 mods at a time to not get overwhelmed. Each ERR/WRN/EXC can be assessed to determine if you should:
- Fix and Report: If you know how to solve the problem so it is no longer generating a log entry, then you can do so and submit the fix and a report to the mod author
- Hide and Report: If you don’t know how to fix it but determine it’s not going to be an issue that’ll get in the way of you playing (bad texture on a part you don’t use) then you can follow the rest of the guide to suppress it. You should still notify the mod author of the issue.
- Remove and Report: If it’s a serious issue you can’t fix, just remove the mod entirely and report the problem.
Suppressing Log Entries
To suppress log entries you don’t want to see, download the FNR application here. Place it in a directory of your choosing.
Create a text file, save/rename it as .bat and insert the following line:
start /b /wait [1] --cl --dir "[2]" --fileMask "*.log" --excludeFileMask "*.dll, *.exe" --useRegEx --find "[3]" --replace ""
[1] – replace this text with the path to your FNR executable
[2] – replace this text with the path to your KSP folder that contains KSP.log
[3] – replace this text with a regular expression that identifies the log entry you want to remove
Example #1
start /b /wait D:\fnr.exe --cl --dir "D:\SteamLibrary\steamapps\common\Kerbal Space Program" --fileMask "*.log" --excludeFileMask "*.dll, *.txt" --useRegEx --find "\[WRN.*\].*Texture isn't eligible for DXT compression, width and height must be multiples of 4" --replace ""
This looks for a specific warning text that is common in a default KSP install, and effectively removes it.
Example #2
start /b /wait D:\fnr.exe --cl --dir "D:\SteamLibrary\steamapps\common\Kerbal Space Program" --fileMask "*.log" --excludeFileMask "*.dll, *.exe" --useRegEx --find "\[WRN.*\].*Cannot have.*ModuleCargoPart.*ModuleInventoryPart" --replace ""
This is another common warning found in a default KSP install however the .* expression is used to only find the two part combination specific to this instance. So if a similar “Cannot have” warning pops up later between two different parts that is not affected.
Example #3
start /wait D:\fnr.exe --cl --silent --dir "D:\SteamLibrary\steamapps\common\Kerbal Space Program" --fileMask "*.log" --excludeFileMask "*.dll, *.exe" --useRegEx --find "\[WRN.*\].*PartResourceDefinition list already contains definition.*(LeadBallast|ResearchKits|Konkrete|Atmosphere|Explodium|Propellium)" --replace ""
Here’s a way to remove specific instances of the warning so you can see a record of everything that you are suppressing. In this case after adding all mods I would remove this line to then see only a report of how many duplicate resources have been defined by various mods and then go check to make sure they are all defined the same or take action if they are different (fix/report/remove).
In place of WRN you can use EXC and ERR to remove other log entries that you wish to ignore on multiple checks of the log after re-running the game. (Yes there are some EXC that actually state they can be ignored!)
You can place as many of these start command lines as you want in the file (each on their own line) and they will all run when you double-click on the batch file in your file explorer.
FNR also has a GUI if you open the executable and want to test regexp commands before committing them to the batch file.
If you’re not familiar with regular expressions (regexp) you can lookup reference material online or ask an AI assistant like ChatGPT to write one for a purpose you describe. This is not always immediately effective but helps get you started in the right direction.
If you want, you can use my batch file as a starting point or for reference.
Analyzing Your Sanitized Log
The batch script will take a few seconds to a minute or so depending on how many replacements you need to do and how big the log file is. Once it has been completed the only ERR/WRN/EXC entries that remain should be new ones generated by a mod or mods you recently installed and/or updated. Some or all of those may already be suppressed and so there will be nothing for you to worry about. But if there’s some still in there they are also buried somewhere within the file. You could do a search to work through them, but a more elegant solution is to get TextAnalysisTool.NET to filter out and display them all at once! Kudos to JonnyOThan for pointing out this program to me on the [rule #1 redacted] Discord. It would look something like this:
You can then select the individual entries and use Ctrl+H to toggle the full log at that location to better see what is responsible for generating it.
Additional Batch Commands
You can choose to add this to the start of your batch file, which will prevent the script from running if KSP is still open, since the log file will just be overwritten by KSP. Useful for those running KSP in a window:
@echo off
tasklist /FI "IMAGENAME eq KSP_x64.exe" 2>NUL | find /I /N "KSP_x64.exe">NUL
if "%ERRORLEVEL%"=="0" (
echo KSP is running!!
pause
exit /b
)
Another optional command that can come after the above and before your start commands is to copy the log file so you have a pristine version to revert to (this assumes the cleanup batch file is in the same directory as the log file):
copy /y ksp.log ksp.log.original