Jump to content

Troubleshoot Mods The Easy Way - KSP.LOG w/ Notepad++ & AnalysePlugin (Windows, Linux)


Recommended Posts

Note to the moderator: I'm unsure if this is the proper forum.  I looked around and it seemed best suited for this category.  If you feel it belongs elsewhere, please move it with my blessing.  Once the post is approved and has found it's proper home, feel free to remove all text with strikethrough.  Or I'll edit later myself... whichever is more appropriate.  Thanks for your work!

:science: My first post!  Glad to be here. I've been a KSP player on-and-off since Early-Access. Amazing, how far it has come!  I love the mods available... so much so that I often install too many :0.0: or take a risk on outdated builds. Then, kablooey! KSP does something crazy or dies. That's when I need to figure out which mods are working properly, which one's can be patched by yours truly, which ones should get a bug report and which ones to remove entirely.  I hope my method can help others quickly do the same. GL/HF/DIY!

:blink: WHAT IS THIS FOR?

This may be helpful if you are a DIY-minded soul and your game is crashing or acting strange and you want to try and identify which mod is causing it.  For the proactive among us, this is even better for making sure all your mods' assemblies, classes, etc are properly loading and interacting with KSP... before you run into some unforeseen, mod-related "thing" 30 minutes into a mission.

-_- WHY NOT JUST LOOK AT THE CONSOLE?

Of course, the quickest way to check for errors when they occur is to Alt-F12 into the console and read the latest entries.  That doesn't always give you the full picture, though (and it certainly won't work is KSP has crashed).  For that, you need to open up the infamous ksp.log file, located in your KSP base folder, to look for errors, warnings and surrounding information.  Ksp.log is a standard-ish Unity log file; full of cryptic data that can nail down a point of failure such as a troublesome mod or a corrupt game file. 

<_< WHY IS THIS BETTER THAN LOOKING AT KSP.LOG THE NORMAL WAY?

  • Parsing a lengthy, black and white text file is not easy for most folks.  So, I offer this quick tutorial on using AnalysePlugin to get at the relevent bits.  A process i use at work as a devops engineer, analyzing all kinds of logs, to great effect.
  • Like many application log files, within ksp.log you'll find irrelevant, deprecated entries and crucial data all are mixed up into one hot mess.  Mining the log for the relevant bits can help you identify a troubled mod and get back to playing your game now, rather than guessing at which mod to remove or waiting hours or days for someone on the forum to analyse your ksp.log for you. 
  • This method helps you get to the relevant information within ksp.log quickly. With a little practice, this will also help you make more effective bug reports to mod developers here and on github.  You'll be able to help them help you by pointing out relevant log entries, to assist them in debugging your issue (along with uploading a full ksp.log file as an attachment, of course!)

:wub: OK, I'M SOLD!  HOW DO I SET THIS UP?

  1. Download and install Notepad++ (NPP). If you already have it, great. (optional step: forget your default text editor ever existed :P)  https://notepad-plus-plus.org/download
  2. Once you have NPP installed, open 'er up and go to the "Plugins" drop-down menu, directly to the left of the "Window" menu, at the top of the application.  You should see an entry in the Plugins drop-down called "Plugin Manager".  If it's there, move to step 3.  If not, get it here: https://github.com/bruderstein/nppPluginManager, install plugin manager and restart NPP.
  3. From the Plugins menu, open Plugin Manager and make sure it can access the Internet, so it can update the repository.  After the repo has been downloaded, check the "Available" tab for "AnalysePlugin".  This plugin will allow us to use a simple set of parameters to highlight and group the errors and warnings in ksp.log, making the job of finding problems much easier on the eyes and brain.  Check the box next to AnalysePlugin and click Install.  Restart Notepad++.
  4. Now, open your ksp.log file in Notepad++. From the Plugins menu, open AnalysePlugin. The screen will split into three parts.  The top left is still the raw ksp.log file you just opened.  At top right, the AnalysePlugin interface.  The bottom is currently empty; this is where our errors and warnings will show.  But first, we need to tell the plugin what to look for. How? Meet me at step 5!
  5. Welcome to step 5, thanks for coming.  Now, you could tell the plugin what to look for manually...OR... load a pre-defined set of parameters instead!  Let's not re-invent the wheel today; that would be very Kerbal-ish. So, here's a free wheel, pre-invented: a super-simple definition file for AnalysePlugin to find warnings and errors. It's something I plan to expand on by exempting deprecated Unity warnings and known irrelevancies... but this basic xml file suits our purposes for the moment.  
  6. Grab "analyse_ksp_log.xml" from my OneDrive, here: https://1drv.ms/u/s!AtC9nbX8Ht1DmslnhdzUgFKSD9IiIg and save it. Save it to your KSP folder, Notepad++ folder or anywhere you like... just be able to get to it for the next step.
  7. Go back to Notepad++ and look at the AnalysePlugin panel.  Under "Visualization" you'll see a group of nine buttons, three down and three across. The top-right button says "Load"; click it.  A file open window appears.  Navigate to wherever you saved analyse_ksp_log.xml.  Select it and confirm.  Now you should see a few entries in the AnalysePlugin's search grid, where once it was empty.
  8. Head back to the same group of nine buttons - at bottom-right, click on "Search".  Eureka!  The bottom panel should now be filled with grey and red lines. Our gold in the mine, so to speak. Grey/Yellow indicates a Warning, Red/White is an error.  The plugin has also bookmarked each line in the raw ksp.log.  Nice.  (You can make the text in the bottom panel bigger or smaller with Ctrl+MouseWheel Up/Down - this works in the top panel also.)

:targetretro: NOW WHAT?

When you click on an error or warning in the bottom panel, the top panel will scroll to that entry in the log, so you can look at all the information surrounding it and get an idea of what happened.  This is insanely useful for figuring out what's actually going on in regard to a particular log entry.  Errors and warnings are a start but, often there will be critical information related to a problem in the surrounding entries.

:normal:DOES KSP NEED TO BE SHUT DOWN?

Nope! This process is great for troubleshooting in real-time. You can perform some actions in the game, switch to Notepad++, hit search on the plugin and see if there were any errors generated by your actions.  For best results in real-time, open the KSP console, select debugging on the left-side menu and place a check in the box next to "Immediately Flush Log File To Disk":ph34r:  Remember to turn this off when you are done as it may affect performance if KSP is constantly logging direct to disk.

:antinormal: SO. MUCH. GREY. AND. RED! 

  • Keep in mind, not every warning or error is a problem that needs solving.  For instance, if you have a mod with wheel parts like Airplane Plus you may see wheelcollider warnings that are erroneous and can be ignored. 
  • Some KSP errors are strictly Unity boilerplate stuff and can be disregarded. For example, you may see a false-positive anti-aliasing error that is deprecated by Unity but, has not yet been removed. 
  • Some mods include assemblies or configs to work with other mods... mods you may not have... those might throw a dependency warning or other error when they do not find the other mod, which is fine.
  • Remember, even with this method, there is still some work to be done on your part to learn what is of concern and what can be disregarded.  Google is your friend.  Duck Duck Go is family :P 

:targetpro: I WANT MORE INFO ON THE BOTTOM PANEL! 

If you want to see "LOG" level entries in the bottom panel along with the ERR and WRN entries: go to AnalysePlugin, in the grid, place a X in the box on the top row, next to "[LOG".  Be advised that LOG WRN and ERR are not the only prefixes in ksp.log.  The bottom panel is not the full picture of what's going on. Treat it like an index.

:rep: HOW ELSE CAN I USE NOTEPAD++ WITH KSP?

A user-defined language file for Notepad++ by forum-member genericeventhandler is useful in conjunction with this process, if you decide to take the next step and dive into some of your mod's .cfg files.  It makes those easier to read by properly coloring comments, delimiters and common keywords. He explains how to use it in his post, linked below. 

If you have any Notepad++ related issues, Plugin Manager issues, etc... please go through those support channels before posting here.  This post assumes that if you want to analyse your own ksp.log file you are also good to install applications and manage plugins. 

My OneDrive will be active forever if I have anything to do with it... and I do... but, if the OneDrive link to analyse_ksp_log.xml is not working, do let me know.  Here's a dropbox mirror, just in case: https://www.dropbox.com/s/sa460qo72jstxwf/analyse_ksp_log.xml?dl=0

I'm an infrequent visitor but, I have turned on notifications, in case anyone needs a clarification.  I'm not a ksp.log analyzing service... there are plenty of folks on the forum who can help you with that.  This is a self-help post. :lol:  Happy analyzing!

Link to comment
Share on other sites

Cool stuff!

Usually, I look into the output_log which doesn't contain '[LOG]', [ERR]', '[WRN]' tags but with a few adjustments to the XML, I should be able to adopt this to work with the output_log as well :)

Thanks for the detailed explanation, I'm sure this will be helpful for many people :)(and advertising Notepad++ & the KSP language config is always a good idea^^)

Link to comment
Share on other sites

  • 1 year later...
On 11/13/2018 at 10:22 AM, 4x4cheesecake said:

Cool stuff!

Usually, I look into the output_log which doesn't contain '[LOG]', [ERR]', '[WRN]' tags but with a few adjustments to the XML, I should be able to adopt this to work with the output_log as well :)

Thanks for the detailed explanation, I'm sure this will be helpful for many people :)(and advertising Notepad++ & the KSP language config is always a good idea^^)

so how did you end up adapting this?

Link to comment
Share on other sites

9 hours ago, zer0Kerbal said:

so how did you end up adapting this?

like, how so?

One thing I just did, was add an entry for "NullRef"... you can add/edit/delete, then save any entries

Thanx for digging this thread up... I'm going to try using this in conjunction with KSPDev Logconsole , which I have been using regular Notepad to read the log files

Link to comment
Share on other sites

14 hours ago, zer0Kerbal said:

so how did you end up adapting this?

I didn't^^

In the end, I was used to go through the logs just by using the search function of notepad++, I usually found the part of the log I'm interested in much fast, then by starting an additional plugin.

If you want to try it anyway: it's a fairly simple xml file which includes the search terms but since the output_log doesn't contain prefixes for errors, warnings, etc, you have to edit them and maybe even add a few more. Can't remember if the terms are case sensitive but that should be easy to find out ;) 

Link to comment
Share on other sites

5 hours ago, Stone Blue said:

Thanx for digging this thread up...

Wow, I never saw this thread! First to @Bearfight (if you're still getting notifications) excellent breakdown and really love the icons, the tone of the writing, and how ultra-informative it is. Honestly, I have to re-read this a couple time to make sure I digest everything - that's a good thing!

That said, have people used the plugin and what are their experiences? It looks like @4x4cheesecake you used it but do it more "manually" via Notepad++?

Link to comment
Share on other sites

1 hour ago, scottadges said:

That said, have people used the plugin and what are their experiences?

Well, I'm going to give this a try.

As a possible alternative, I'll post what I've been doing up to reading this thread.

I've been using IgorZ's (of KAS/KIS fame) mod, KSPDev LogConsole , along with opening the logs it generates, with Notepad, not NP++. (Only because Notepad gives me a less cluttered UI, and moar screenspace for the loooong lines of text in the logs (I also turn off wordwrap, as its easier on the eyes, and lines up the timestamps and entry types (ie INFO, ERROR, WARNING, EXCEPTION), nicely.))

So, I have LogConsole set to create a full copy of the KSP.log, and a parsed one that includes ONLY the ERR/WRN/EXC lines. These are two seperate .txt files.
I will open them both in seperate windows. I first go thru the parsed log, and when I find an ERR/WRN/EXC I want to investigate, i note the timestamp, switch to the window with the full log, and can quickly locate ALL the relevant lines quite quickly.

I dont ever use the output_log/Player.log myself, as I dont understand much of it, and only supply it along with a KSP.log if I'm asking for support on the forums.

Note that KSPDev LogConsole, *also* has a nice in-game UI, so you can see whats going on right in-game. I havent bothered to use it tho :P

Edited by Stone Blue
Link to comment
Share on other sites

I have been using @IgorZ's  KSPDev LogConsole (until I accidentally deleted the folder and couldn't remember what/where to find it again - again thank you @Stone Blue)

I just started using it and it works good so far, and I like it. Issue I keep running into is finding the actual lines of the log I am looking for. This helps. Colors are kind of jarring - still I can fix that.

13 hours ago, Stone Blue said:

One thing I just did, was add an entry for "NullRef"... you can add/edit/delete, then save any entries

would you mind terribly providing the code for that? If not, please do.

13 hours ago, Stone Blue said:

Thanx for digging this thread up... I'm going to try using this in conjunction with KSPDev Logconsole , which I have been using regular Notepad to read the log files

Stumbled across it (again) when I was trying to find the KSPDEv.Logconsole app. :D

Any other obscure apps out there besides the obvious MADLAD et al that might be useful to a fellow moder?

 

8 hours ago, 4x4cheesecake said:

If you want to try it anyway: it's a fairly simple xml file which includes the search terms but since the output_log doesn't contain prefixes for errors, warnings, etc, you have to edit them and maybe even add a few more. Can't remember if the terms are case sensitive but that should be easy to find out ;) 

I like it so far. I don't have the screen space to do it that way - already too cluttered of a personal dev enviroment here. :eek:

6 hours ago, Stone Blue said:

So, I have LogConsole set to create a full copy of the KSP.log, and a parsed one that includes ONLY the ERR/WRN/EXC lines. These are two seperate .txt files.
I will open them both in seperate windows. I first go thru the parsed log, and when I find an ERR/WRN/EXC I want to investigate, i note the timestamp, switch to the window with the full log, and can quickly locate ALL the relevant lines quite quickly.

I would like to set it up that way; rather than me experimenting with the wiki to do the same; would you kindly provide your config file (just a spoiler+code)?

6 hours ago, Stone Blue said:

Note that KSPDev LogConsole, *also* has a nice in-game UI, so you can see whats going on right in-game. I havent bothered to use it tho

I have been using it - and it is very powerful. only thing I don't like about it is it is full screen width - which can be annoying to me.

 

Loving this conversation!

Thank you to @Bearfight for creating this.

+1 :rep:

Edited by zer0Kerbal
Link to comment
Share on other sites

Erm:

On 11/12/2018 at 4:59 PM, Bearfight said:

Troubleshoot Mods The Easy Way - KSP.LOG w/ Notepad++ & AnalysePlugin (Windows, Linux)

On 11/12/2018 at 4:59 PM, Bearfight said:

Download and install Notepad++ (NPP).

On 11/12/2018 at 4:59 PM, Bearfight said:

There be no GNU/Linux builds at that URL...

Link to comment
Share on other sites

8 hours ago, zer0Kerbal said:

would you mind terribly providing the code for that? If not, please do.

No code necessary.... I just started playing with the buttons/entries in the right hand section of the UI :P
IIRC, "Add", lets you make additional entries. Also, since the entry types in the KSP.log seem to have been changed from one of the recent Unity updates, I had to delete the [ERR & [WRN entries (they dont work anymoar)... I created [ERROR, [WARNING, and then added "exception" (no quotes).

For NullRefs, I created one for "nullref" (no quotes)... but on this one, I guess because it shows up in the middle of "
System.NullReferenceException", it wont get picked up. So you have to switch the "Search type" setting on this from "normal" to "regex".

So far, I am liking this. There are mods I use that throw TONS of warnings that can be ignored, such as incorrect texture resolution, or KSPAVC throwing a bunch of addon binder errors, and tons from Filter Extensions... I just wish there was a way the Analyse Plugin could also *parse* entries... vOv

I also kinda wish KSPDev LogConsole could parse by user custom text entries, not just by method... vOv
I also would LOVE to parse out the DATE from the log entries, to just using the time. Unfortunately, I havent found a way to do that using KSPDev LogConsole. If someone knows how/if its possible, PLEASE tell me. :P
(the date/time setting in the settings.cfg, is for the date/time in the *filename* for the saved output logs :P )
I *did* remove the year and seconds from that... I dont know about anyone else, but I dont keep logs around long enuff I need to know what *year* they are from, nor is my computer powerful enuff to start instances of, or run KSP within seconds of itself... :P ) But I *am* glad the whole setting is customizable, in case my use-case ever changes.

9 hours ago, zer0Kerbal said:

I would like to set it up that way; rather than me experimenting with the wiki to do the same; would you kindly provide your config file (just a spoiler+code)?

Yeah, I can do that, but be aware, I customized quite a few settings. Mainly, I "turned off" MM patch loader logs, as well as the KSPAVC and MiniAVC log flushers. I did this because they all add SOOO much content to the KSP.log, which makes it moar difficult to go thru, and I also know they can be set to create their *own* seperate logs, so i can use those if i need to.

It may be redundant, I dont remember, since its been so long, but I also use the MM dont copy logs CLI on my KSP shortcut.
**NOTE: with this one, you need to remember when providing logs to peopple for support requests, to either turn it off and start KSP to get a fresh log *WITH* all the MM loader info; or provide the seperate MM log *along with* your KSP.log ... But its prolly best to turn off the CLI commmand, and just do a fresh restart.
(I'm guilty myself of forgetting to do this... :face_palm:)

Heres the settings.cfg:

Spoiler

UI
{
    consoleToggleKey = BackQuote
    ColorSchema
    {
        errorLog = 1,0,0,1
        exceptionLog = 1,0,1,1
        infoLog = 1,1,1,1
        warningLog = 1,1,0,1
    }
}
PlainLogAggregator
{
    maxLogRecords = 300
    rawBufferSize = 1000
}
CollapseLogAggregator
{
    maxLogRecords = 300
    rawBufferSize = 1000
}
SmartLogAggregator
{
    maxLogRecords = 300
    rawBufferSize = 1000
}
PersistentLog
{
    maxLogRecords = 300
    rawBufferSize = 1000
    enableLogger = True
    logFilePrefix = LOG
    logFilesPath = GameData/KSPDev/logs
    logTsFormat = -MMddTHHmm
    writeErrorFile = False
    writeInfoFile = True
    writeWarningFile = True
    cleanupPolicy
    {
        totalFiles = 30
        totalSizeMb = 100
        maxAgeHours = 168  // 7 days
    }
}
LogFilter
{
    ExactMatchFilter
    {
        source = PartLoader.GetDatabaseConfig
        source = DragCubeSystem+.MoveNext
        source = PartLoader+.MoveNext
        source = PartLoader+.MoveNext
        source = PartLoader+.MoveNext
        source = GameDatabase+<LoadObjects>c__Iterator4A.MoveNext
        source = PartLoader+<CompileParts>c__Iterator62.MoveNext
        source = DragCubeSystem+<RenderDragCubesCoroutine>c__Iterator1D.MoveNext
        source = PartResourceLibrary.LoadDefinitions
        source = PartLoader+<CompileInternalSpaces>c__Iterator64.MoveNext
        source = PartLoader+<CompileInternalProps>c__Iterator63.MoveNext
        source = GameDatabase+<CreateDatabase>c__Iterator49.MoveNext
        source = KSPAssets.Loaders.AssetLoader+<LoadDefinitionsAsync>d__30.MoveNext
        //source = ModuleManager.MMPatchLoader+<ProcessPatch>d__46.MoveNext
        source = GameDatabase+<LoadObjects>c__Iterator1.MoveNext
        source = AssemblyLoader.GetSubclassesOfParentClass
        source = PartLoader+<CompileInternalProps>c__Iterator2.MoveNext
        source = PartLoader+<CompileInternalSpaces>c__Iterator3.MoveNext
    }
    PrefixMatchFilter
    {
    }
}
LogInterceptor
{
    enableInterception = True
    ExactMatchOverride
    {
        source = UnityEngine.Application.CallLogCallback
        source = UnityEngine.MonoBehaviour.print
        source = KSPPluginFramework.MonoBehaviourExtended.LogFormatted
        source = TWP_KACWrapper.KACWrapper.LogFormatted
        source = KAC_KERWrapper.KERWrapper.LogFormatted
        source = KAC_VOIDWrapper.VOIDWrapper.LogFormatted
        source = SCANsat.SCANUtil.SCANlog
        source = SCANsat.SCANmainMenuLoader.debugWriter
        source = KAS.KAS_Shared.DebugLog
        source = KAS.KAS_Shared.DebugError
        source = InfernalRobotics.Logger.Log
        source = KerbalEngineer.Logger.Flush
        //source = MiniAVC.Logger.Flush
        //source = KSP-AVC.Logger.Flush
        //source = ModuleManager.MMPatchLoader.log
    }
    PrefixMatchOverride
    {
        sourcePrefix = UnityEngine.Debug.
        sourcePrefix = UnityEngine.DebugLogHandler.
        sourcePrefix = UnityEngine.Logger.
        sourcePrefix = KSPDev.ConfigUtils.ConfigAccessor.
        sourcePrefix = KSPDev.LogUtils.HostedDebugLog.
        sourcePrefix = KSPDev.LogUtils.DebugEx
    }
}

 





 

Link to comment
Share on other sites

4 hours ago, Stone Blue said:

No code necessary.... I just started playing with the buttons/entries in the right hand section of the UI :P

thank you - been playing with it and have added your suggestions and things like

  • ODFC
  • SimpleConstruction
  • SimpleLogistics
  • Biomatic
  • TrainingLab
  • TrainingFacility
  • ProbiTronics

This is making my life SO much easier. couple of clicks and easier troubleshooting.

4 hours ago, Stone Blue said:

So far, I am liking this

so.am.I.

4 hours ago, Stone Blue said:

I also kinda wish KSPDev LogConsole could parse by user custom text entries, not just by method... vOv

I like, so we'll tag and ask @IgorZ, and it might be done. :D

4 hours ago, Stone Blue said:

LOVE to parse out the DATE from the log entries

agree.

4 hours ago, Stone Blue said:

Unfortunately, I havent found a way to do that using KSPDev LogConsole. If someone knows how/if its possible, PLEASE tell me. :P

same glad you did what you did for KSP.LogConsole. Thank you for the settings.cfg; I backed it and the original up - so in case I need to provide an unadulterated version.

 

 

Link to comment
Share on other sites

2 hours ago, zer0Kerbal said:

Well, waiting for notepadqq to compile only to find that it doesn't have plugin support was rather disappointing... And running notepad++ in wine is hardly deserving of (Linux) in the title... or something I'm going to do.
Oh well, it looked kinda handy. Nevermind then.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...