'How to adjust the log output level of GTK4?
When developing an application based on GTK4, a log will be printed every time it is started. How can I get rid of it?
(conquerdocker:17460): Gtk-WARNING **: 09:13:21.962: Unknown key gtk-button-images in /home/aszswaz/.config/gtk-4.0/settings.ini
(conquerdocker:17460): Gtk-WARNING **: 09:13:21.962: Unknown key gtk-menu-images in /home/aszswaz/.config/gtk-4.0/settings.ini
(conquerdocker:17460): Gtk-WARNING **: 09:13:21.963: Unknown key gtk-toolbar-style in /home/aszswaz/.config/gtk-4.0/settings.ini
Solution 1:[1]
If you are not concerned about having any log output when you are executing your program, you could call your program and redirect the logging output to "/dev/null", such as:
./your_program_name > /dev/null
Alternatively, since your program is most likely a GUI program and doesn't require a terminal/console window, you could set up a desktop file similar to the following example.
[Desktop Entry]
Type=Application
Name=GtkProgramName
Icon=/home/username/.local/share/icons/hicolor/48x48/apps/GTK.png
Categories=Utilities;
StartupNotify=true
Terminal=false
Exec=/path/to/your/Programs/your_program_name
The key attribute here is the "Terminal=false" attribute which will run your program without a terminal, and therefore a user would not see spurious messages. Desktop files usually are placed in the "~/.local/share/applications folder" and have a permission mask of "rw-rw-r--".
You might give those options a try.
Regards.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | NoDakker |