Where are MS4 plugin runtime errors seen?
Developing a plugin in MS4 is proving to be quite a slow, iterative process because there doesn't appear to be any console output, so something like a simple syntax error, (a missed quote, comma or semicolon), results in a blank dialog window at runtime and no clue as to what or where the error might be.
Is this information available anywhere?
Here's an example of iterations made within a single 30 minute period on my ImportVelocity plugin:
I wipe out the files every 10 iterations so that this list doesn't get too long. As I said, it's proving to be a slow process.
System: MS4.5.1 on Windows 11 using Notepad++ as editor.
Comments
Check the logs in C:\Users\YOURNAME\AppData\Local\MuseScore\MuseScore4\logs
In reply to Check the logs by Jojo-Schmitz
Thanks. Looks like a task for tomorrow.
In reply to Check the logs by Jojo-Schmitz
That seems to work for errors, but is there a way to explicitly write to the log? Since console.log() doesn't seem to do anything in v.4?
In reply to That seems to work for… by TheHutch
You can assign this task to a text box in the plugin (as long as it has a window), to be deleted when the job is finished. Pretty boring...
In reply to You can assign this task to… by ILPEPITO
.
In reply to That seems to work for… by TheHutch
As above, I would suggest using a window with a text area.
I do this:
Where:
zLog is a property var true/false to say whether debug logging is on of off.
info is any text string or expression to pass to the log
zclr is true/false to control whether the new text string should clear the window first
iTab is the indentation level which I change by +/- 4 when I require an indent change
logText is the text contents of the window
Here's an example of the output:
In reply to As above, I would suggest… by yonah_ag
Property vars are defined near the top of the plugin:
In reply to As above, I would suggest… by yonah_ag
Here's an enhanced version of the log window which scrolls:
In reply to Check the logs by Jojo-Schmitz
Re: Jojo-Schmitz • May 18, 2025 - 21:37
Check the logs in C:\Users\YOURNAME\AppData\Local\MuseScore\MuseScore4\logs
OK, it's quite busy but very handy.
Has already saved me a couple of iterations by spotting a syntax error.
If I can give a piece of advice, it doesn't seem like a good idea to develop a plugin in MS4. In the case of 'properties' with a different name, nothing prevents you from developing the plugin with MS3.6.2, changing what needs to be changed to the finished 'product'. Consulting log files is certainly useful when there is no alternative, but it is an unbearably slow mechanism.
In reply to If I can give a piece of… by ILPEPITO
I am migrating to MS4 because my MS3.7 can no longer upload to musescore.com so I sadly have to let it go. I have made one MS4 plugin, (https://musescore.org/en/project/tab-bold-ms4), and the UI definition was so different that converting from MS3 would also be tedious.
I can open the log file in Notepadd++ and automatically reload it when it changes.
In reply to If I can give a piece of… by ILPEPITO
I'm just starting to write plugins. I have no desire to go back in time to MuS 3, which I haven't had installed for something like two or three years. MuS 4 is the future ... and the present, for that matter.
In reply to I'm just starting to write… by TheHutch
MS4 is still seriously deficient for some of us so that MS3.7 is still "the present".
In reply to If I can give a piece of… by ILPEPITO
OK, I see what you mean about the log file but it's could be useful if all else fails.
I can use a bit of regex and load the contents into a wide popup window via the plugin.