Search code examples
cloggingglib

GLib not printing info or debug log levels despite G_MESSAGES_DEBUG being set to all


I have the following code:

g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "Test log (info level)");
g_info("Test info");
g_debug("Test debug");
g_message("Test message");
g_warning("Test warning");
g_error("Test error");

However, only the message, warning, and error log levels get printed. I ran set G_MESSAGES_DEBUG=all in my shell before running the program, but the debug and info messages were still suppressed.

How can I make GLib print all log levels?


Solution

  • Oops, looks like I didn't know how to set environment variables properly. Using export G_MESSAGES_DEBUG=all works like a charm.