Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print_debug prints in release mode #48068

Closed
MegaMasta opened this issue Apr 21, 2021 · 5 comments
Closed

print_debug prints in release mode #48068

MegaMasta opened this issue Apr 21, 2021 · 5 comments

Comments

@MegaMasta
Copy link

MegaMasta commented Apr 21, 2021

Godot version:

v3.2.3.stable.official

OS/device including version:

Windows 10 64-bit Build 19041.928

Issue description:

Using print_debug in an exported build with mode "Release" prints messages.
According to the docs, it is expected that print_debug only prints when exported in debug mode or ran from the IDE.

Steps to reproduce:

  • In GDScript use print_debug("anything")
  • (If not done already:) Import export templates (download from https://www.godotengine.org/download)
  • Export with mode "Release" (respectively "Export with Debug" disabled)
  • Run the exported program and look at the output (for example, in a Windows build redirect stdout to a file).
    -> It prints "anything"

Minimal reproduction project:

Test_print_debug.zip
Note: In this project, there is also a comparison code using OS.is_debug_build, which works correctly.

@Calinou
Copy link
Member

Calinou commented Apr 21, 2021

It's possible that this only happens with file logging, rather than stdout logging.

However, on Windows, you can't inspect a program's command line output from a command prompt if it was compiled with the GUI subsystem (rather than the console subsystem). Release export templates are compiled with the GUI subsystem, unlike the editor and debug export templates which are compiled with the console subsystem.

@Sslaxx
Copy link

Sslaxx commented Apr 22, 2021

Can confirm this under Linux (Ubuntu 20.04) with 3.3 stable. Release builds, 64-bit.

Using release mode, I get this output on the terminal:

OpenGL ES 2.0 Renderer: GeForce GTX 1650/PCIe/SSE2
OpenGL ES Batching: ON
 
res://Scripts/Singletons/helper_functions.gd ready. Node [Node:1163] (helper_functions).
res://Scripts/Singletons/random_helpers.gd ready. Node [Node:1168] (random_helpers).
RNG initialised; seed is 8698224463306719903.
res://Scripts/Singletons/sound_player.gd ready. Node [AudioStreamPlayer:1175] (sound_player).
res://Scripts/Singletons/music_player.gd ready. Node [AudioStreamPlayer:1180] (music_player).
res://Scripts/Singletons/jingle_player.gd ready. Node [AudioStreamPlayer:1185] (jingle_player).
res://Scripts/scn_preload.gd ready. Node [Node2D:1206] (Preloader).
Current sound_library contents: {no_sound:[AudioStreamOGGVorbis:1172], select:[AudioStreamOGGVorbis:1212]}
Current sound_library contents: {lose_influence:[AudioStreamOGGVorbis:1214], no_sound:[AudioStreamOGGVorbis:1172], select:[AudioStreamOGGVorbis:1212]}
Current sound_library contents: {gain_influence:[AudioStreamOGGVorbis:1216], lose_influence:[AudioStreamOGGVorbis:1214], no_sound:[AudioStreamOGGVorbis:1172], select:[AudioStreamOGGVorbis:1212]}
AAA: snd_sfx_ring.ogg
res://Scripts/main_menu.gd ready. Node [Control:1229] (main_menu).
Playing [AudioStreamOGGVorbis:1250] from res://Assets/Audio/Music/01-Title.ogg, offset 0.

godot.log is a copy of a log file from an exported program run in release mode.

@MegaMasta
Copy link
Author

MegaMasta commented Apr 23, 2021

According to the Pull Request #18966 and the implemented feature issues #3884 and #18319, it wasn't intended that print_debug only prints in debug mode, but rather prints the file and line of the code where the print happens. And it seems like that extra debug information is only printed when ran from the IDE.

More importantly, there was an issue #6253, where this feature (only printing in debug mode) was rejected:

Since it is possible to easily implement this feature by adding a very short function to a singleton, I'm closing this. (It is also more flexible this way.)

The doc to print_debug was added in #44911, 2.5 years later.

So for me the doc is just wrong.
Should the doc be fixed?

@Sslaxx
Copy link

Sslaxx commented Apr 23, 2021

Note that print_debug did not exist at the time I opened #6253. #18966 makes no referral to when print_debug should work. I would assume the documentation to be correct in this instance.

@akien-mga
Copy link
Member

Fixed by #63243.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants