Debug messages from KWin script (using console.log()) not present in the journal in spite of setting Full Debug in KDebugSettings

I have Kröhnkite KWin script (GitHub - anametologin/krohnkite: A dynamic tiling extension for KWin) installed and activated.
As seen at krohnkite/res/main.qml at 0.9.8.2 · anametologin/krohnkite · GitHub it outputs log message using console.log():
console.log("KROHNKITE: starting the script");

However after setting KWin Scripting log level to Full Debug and removing *.debug=false rule from Custom Rules in KDebugSettings I don’t see this message (and other log messages from this script) in KSystemLog.

Originally I raised this problem at No log entries after turning "Debug new Windows" option on · Issue #94 · anametologin/krohnkite · GitHub
Related:
https://www.reddit.com/r/kde/comments/15jm7me/debug_printing_in_kwin_scripts/
https://www.reddit.com/r/Fedora/comments/15kiv2c/kde_or_fedora_issue_print_in_kwin_script_not/
Wayland and Plasmashell are spamming my syslog

[piotr@demon]~% kinfo
Operating System: Fedora Linux 41
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.7.0
Qt Version: 6.7.2
Kernel Version: 6.11.3-300.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 7600 6-Core Processor
Memory: 14.8 GiB of RAM
Graphics Processor: AMD Radeon Graphics

Use print() in kwin scripts, not console.log().

In KWin scripting tutorial in KWin scripting basics’ Output section it’s written:

print(QVariant...): prints the provided arguments to stdout. Takes an arbitrary number of arguments. Comparable to console.log() which should be preferred in QML scripts.

I take it to mean that in QML script (and this is what we have here as the console.log() is used in the main.qml file) it’s console.log() which should be used, not print().

Anyone?? (bump)

However after setting KWin Scripting log level to Full Debug and removing *.debug=false rule from Custom Rules in KDebugSettings I don’t see this message (and other log messages from this script) in KSystemLog.

KWin Scripting is for internal logging, that is from KWin scripting Api C++ implementation.

KWin scripts don’t share its logging settings by default.
It is still affected by Qt QLoggingCategory Class | Qt Core 6.8.0
And you can use LoggingCategory QML Type | Qt Qml 6.8.0 from qml with name kwin_scripting, it should work.

You can use a prefix for your outputs so they are easy to find amoung the *.debug=true noice.

Thanks for all the information however it’s not my code and it seems to work for others (they see log entry which I don’t).

At LoggingCategory QML Type | Qt Qml 6.8.0 we read

If supplied to the logger the LoggingCategory’s name will be used as logging category. Otherwise the default logging category will be used.

Kröhnkite calls console.log("KROHNKITE: starting the script"); where no logging category is being passed so I think the default logging category is used. However there’s no information at the above link on what’s the default logging category? At No log entries after turning "Debug new Windows" option on · Issue #94 · anametologin/krohnkite · GitHub anametologin writes

you have to see qml: KROHNKITE: starting the script

Is the qml prefix the name of logging category and does it mean that the default logging category in qml scripts is qml?
The question remains; why don’t I see this log entry and others do?

Coud someone please help me with this?
Thanks in advance.

Hi - maybe a silly question on my part (I’m no expert!), but have you checked out the KDE Community Wiki page about KWin debugging? KWin/Debugging - KDE Community Wiki

The reason I ask is that it sounded like you were looking for KWin debug messages in the system journal, but if I understand correctly, I believe those messages would actually be output to a separate file - might be worth double-checking?

I believe that KWin (and other parts of KDE) use system journal for logging after KDE moved to systemd as a way of starting all services. Take a look at https://www.reddit.com/r/kde/comments/tho8m5/how_to_get_full_kwin_wayland_debug_output/?rdt=35173 and the solution which mentions Plasma and the systemd startup – David Edmundson's Web Log article which has Logging section which suggest KDE uses system journal.

1 Like

I am dealing with this issue right now and didn’t find the answer to it. Have you solve it yet?

No, still no luck. If you find out please share it with us here.

What are the contents of ~/.config/QtProject/qtlogging.ini?

This is what I have on mine and I see KWin debug messages

[Rules]
kwin_scripting=true

qml.debug=true