• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Linux Is it possible to capture error messages in Linux console or log file?

Elevory

Member
Hello,

I'm running a GameMaker server on Ubuntu Server, without a GUI.

I can monitor my app through console output, which works great for the most part. However, if the app crashes, it does not seem to produce error details anywhere...

After doing some research, I found an exe flag that will send debug output to a file, but it appears to be Windows-only:

-debugoutput <filename>: sends debug messages and console output to the filename

Is there anything similar for Linux?

Thank you!
 

Samuel Venable

Time Killer
Hello,

I'm running a GameMaker server on Ubuntu Server, without a GUI.

I can monitor my app through console output, which works great for the most part. However, if the app crashes, it does not seem to produce error details anywhere...

After doing some research, I found an exe flag that will send debug output to a file, but it appears to be Windows-only:

-debugoutput <filename>: sends debug messages and console output to the filename

Is there anything similar for Linux?

Thank you!
Yes you can use -debugoutput on Windows, Mac, and Linux. In the case of Linux if you are running with the VM export you have to pass game.unx to the -game flag. The page needs to be updated as it used to be Windows-only.
 

Elevory

Member
Yes you can use -debugoutput on Windows, Mac, and Linux. In the case of Linux if you are running with the VM export you have to pass game.unx to the -game flag.
Oh, that's great news - thank you! I'll play around with it some more.

I'm not sure if these docs are outdated, but I see here it mentions that command line parameters are only available on the standard Windows target module:

I couldn't find an equivalent article in the GMS2 manual, so I assumed it was up to date. Worth reporting maybe?

Thanks again.
 

Samuel Venable

Time Killer
Actually, looks like the new docs say the same thing - Windows target only:

Just try it. I've done it myself a lot. Not sure why they are saying it still if it clearly isn't the case.

Edit:

I'm just going off of what Nocturne said that it used to be Windows-only. But it has been able to do that since GameMaker Studio 1.x because I still do it in my copy of 1.4 as well (on all 3 of those platforms).


Edit2:

Additionally, my process information extension can return the debug output in code to a game exe that launched a different one, without having to write it to a text file, which writing to text files is generally slow. Let me know if you want more information on how to do that. It's available for and can do this on Windows, Mac, and Linux.

Edit3:

GameMaker recently added the ability to replace error message dialogs with your own desired code to show that information, in which case you can do that with show_debug_message.

Edit4:

Here's a demo project of how to use my process info extension to run multiple game instances from one exe, each game file you load and run must be built with the same version of game maker you compiled this project with: https://www.dropbox.com/s/z592xd2ju42mmq7/GameMaker Runner.yyz?dl=0
 
Last edited:

Elevory

Member
Hi Samuel,

Thank you for all the extra info! I am running some tests with the debugoutput flag. It wasn't working for me before, but I think maybe I needed to create the debug.txt manually and give it the right permissions. We'll see if that makes a difference.

Additionally, my process information extension can return the debug output in code to a game exe that launched a different one, without having to write it to a text file, which writing to text files is generally slow. Let me know if you want more information on how to do that. It's available for and can do this on Windows, Mac, and Linux.
Yes, I'd love to know more about this approach!
 

Samuel Venable

Time Killer
Yes, I'd love to know more about this approach!
I added an additional edit before I knew you replied, which should go a long way in answering your questions:

Edit4:

Here's a demo project of how to use my process info extension to run multiple game instances from one exe, each game file you load and run must be built with the same version of game maker you compiled this project with: https://www.dropbox.com/s/z592xd2ju42mmq7/GameMaker Runner.yyz?dl=0
Update the extension, if needed, from itch.io for the most recent version for the version of GM you are using:

Also, add me in discord for faster support: Samuel Venable#5465

(talking in realtime helps a lot)

Edit:

If you update to the latest version of dialog module as well, there have been internal changes that will cause a crash, so to fix that, change this line: widget_set_owner(window_handle()); to this: widget_set_owner(string(int64(window_handle())));.
 
Last edited:

Luvexian

Member
Yes you can use -debugoutput on Windows, Mac, and Linux. In the case of Linux if you are running with the VM export you have to pass game.unx to the -game flag. The page needs to be updated as it used to be Windows-only.

Hello Samuel,
I wish to receive error messages on my ubuntu server.
So, I tried it on my ubuntu server by typing 'xvfb-run ./<my game name> -output debug.txt'
But it didn't work.

So I searched threads and found your answer!
But I can't understand your message 'you have to pass game.unx to the -game flag.'

I tried this by tying 'xvfb-run ./<my game name> -output debug.txt -game game.unx'
and yoyo runner says

***************************************
* YoYo Games Linux Runner V1.3 *
***************************************
CommandLine: -output debug.txt -game game.unx -game game.unx

And it didn't work.
It seems commanline '-game game.unx' is default because without adding any parameters, it says

***************************************
* YoYo Games Linux Runner V1.3 *
***************************************
CommandLine: -game game.unx

I feel I did it wrong :(
Can you please explain how to do it for me?
 

Samuel Venable

Time Killer
Hello Samuel,
I wish to receive error messages on my ubuntu server.
So, I tried it on my ubuntu server by typing 'xvfb-run ./<my game name> -output debug.txt'
But it didn't work.

So I searched threads and found your answer!
But I can't understand your message 'you have to pass game.unx to the -game flag.'

I tried this by tying 'xvfb-run ./<my game name> -output debug.txt -game game.unx'
and yoyo runner says

***************************************
* YoYo Games Linux Runner V1.3 *
***************************************
CommandLine: -output debug.txt -game game.unx -game game.unx

And it didn't work.
It seems commanline '-game game.unx' is default because without adding any parameters, it says

***************************************
* YoYo Games Linux Runner V1.3 *
***************************************
CommandLine: -game game.unx

I feel I did it wrong :(
Can you please explain how to do it for me?
Try passing the game file first, and see if providing the full path helps at all:

xvfb-run ./<my game name> -game /path/to/game.unx -output /output/path/debug.txt

Using environment variables may also be helpful like $HOME to get your home folder. Relative paths should also work, but I am not in a place to debug this right now.
 

Luvexian

Member
Try passing the game file first, and see if providing the full path helps at all:

xvfb-run ./<my game name> -game /path/to/game.unx -output /output/path/debug.txt

Using environment variables may also be helpful like $HOME to get your home folder. Relative paths should also work, but I am not in a place to debug this right now.
Hello, Mr. Samuel. Thank you for your reply!
I tried what you said by typing on my ubuntu server putty :
xvfb-run ./mygame -game $HOME/myfolder/assets/game.unx -debugoutput $HOME/myfolder/debug.txt

and it said :


***************************************
* YoYo Games Linux Runner V1.3 *
***************************************
CommandLine: -game /home/ubuntu/myfolder/assets/game.unx -debugoutput /home/ubuntu/myfolder/debug.txt -game game.unx
ExeName= /home/ubuntu/myfolder/mygame
MemoryManager allocated: 52459
Create Error Form

***************************************
* YoYo Games Runner v1.0(999)[r32908] *
***************************************
RunnerLoadGame: game.unx
RunnerLoadGame() - assets/game.unx
YYG Game launching. Game file: assets/game.unx
Checking if INIFile exists at assets/options.ini
INIFile assets/options.ini Exists, loading....
INI DisplayName=Created with GameMaker Studio 2
Reading File assets/game.unx
Loaded File assets/game.unx(255948)
IFF wad found
Get Resolution
Get Header Information
InitGMLFunctions
HighScore..SavePrePend /home/ubuntu/.config/mygame/
. . .

As you see, it says 'Create Error Form' and YoYo Games Runner v1.0(999)[r32908] was executed.
But no debug.txt file was made.
My game path is /home/ubuntu/myfolder/mygame
and game.unx path is /home/ubuntu/myfolder/assets/game.unx
CommandLine says accurate path, so I think I typed right path.
Then, what was wrong ? ;( Please help me Mr. Samuel.
 

Samuel Venable

Time Killer
I wrote a demo project that demonstrated how to do this with my execute shell extension. I ended up deleting it from github because my dll ended up exceeding the max upload size. I'll make a new project and upload it somewhere else.
 
Top