Problems with logging from gnome-shell extensions

While trying to port an extension to Gnome 45 using console.log() and siblings I noticed that some log levels don’t show in the journal at all (using “journalctl -p debug”), while others aren’t shown severity wise as I would have expected:

        console.debug("FOO debug");     // not shown"FOO info");       // not shown
        console.log("FOO log");         // shown in bold (NOTICE)
        console.warn("FOO warn");       // shown in yellow (WARNING)
        console.error("FOO error");     // shown in yellow (WARNING)

Is the omission of debug and info levels due to some cut-off level set by gnome-shell (that may be raised somehow)? Or is the mapping from gjs (ie.Glib.LogLevelFlags) to journal severity to blame?

It’s neither gnome-shell nor gjs, but glib:

The messages show up if you G_MESSAGES_DEBUG="GNOME Shell" is set in the environment of the gnome-shell process.

Thanks, works perfectly:

For future reference, setting this environment variable can be achieved (on a machine using systemd) by creating a file ~/.config/systemd/user/org.gnome.Shell@wayland.service.d/debug.conf with the following content

# make gnome-shell show messages for *all* log levels
Environment="G_MESSAGES_DEBUG=GNOME Shell"

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.