+3 votes

I am running godot server using the following command:

./godot-server --main-pack game.pck

which displays output like this:

Godot Engine v3.2.1.stable.official - https://godotengine.org

ERROR: get_language_code: Condition "p_locale.length() < 2" is true. Returned: p_locale
   At: core/translation.cpp:945.
ERROR: set_locale: Unsupported locale 'C', falling back to 'en'.
   At: core/translation.cpp:969.
Starting game

When I try to capture this output into a log file like this:

./godot-server --main-pack game.pck &> /tmp/test.log

I end up with only the stderr in the log file, and not the stdout:

ERROR: get_language_code: Condition "p_locale.length() < 2" is true. Returned: p_locale
   At: core/translation.cpp:945.
ERROR: set_locale: Unsupported locale 'C', falling back to 'en'.
   At: core/translation.cpp:969.

I actually first noticed this when trying to run the server from a systemd service, the stdout is not being captured by journalctl.

Any thoughts? possible bug? buffers not being flushed or something?

in Engine by (18 points)
edited by

1 Answer

+1 vote
Best answer

Any thoughts? possible bug? buffers not being flushed or something?

That's correct. In the interest of performance, Godot will only flush the buffer when it exits.

This should probably be changed for server builds at least, as this is problematic for logging using systemd.

by (11,891 points)
selected by

Thanks a lot for the response! Glad my hunch was confirmed and I wasn't doing something silly :D

Should I open a Godot Improvement Proposal regarding this?

In the short term, is there any way to flush it from within the software?

Hey @ian! Did you end up logging this item? I'm running into the same issue and can't seem to get a systemd run godot headless server to log anywhere.

Hi @broknecho,

I didn't solve this issue, but I worked around it by always using printerr() instead of print(). Nasty solution but my server code is very light, so it wasn't a big deal for me.
I created an issue here about it, if you wish to track it:
https://github.com/godotengine/godot-proposals/issues/1912

Hi @Ian!

Thanks for posting the issue. It was super weird as I didn't see any logging in my testing but I finally ran a pretty big load test against the running Godot service and journalctl did finally start showing some output. I wonder if the buffer size was getting too big and flushed itself before a restart.

The other option I was thinking about was to use the mono build and bring in some serilog sinks to do some logging.

Thanks again for posting this and I thumbed it up to watch it.

So what is the short term work around for this?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.