Skip to content

fix(logging): keep debug output out of the journal - #165

Open
m-wilkowski wants to merge 1 commit into
mmaher88:masterfrom
m-wilkowski:fix/logging-keep-debug-out-of-journal
Open

m-wilkowski wants to merge 1 commit into
mmaher88:masterfrom
m-wilkowski:fix/logging-keep-debug-out-of-journal

Conversation

@m-wilkowski

@m-wilkowski m-wilkowski commented Oct 17, 2026 •

Copy link
Copy Markdown

Closes #112.

Problem

main.cpp starts the app with LogManager::init(true), so the debug preset is on for every user, and LogManager::messageHandler echoes every message to stderr. When the app starts from the desktop autostart entry, stderr goes to the systemd journal, so each debug line ends up twice: once in ~/.local/share/Logitune/Logitune/logs/ and once in the journal.

Most of the volume comes from two per-event lines: raw hidraw: in DeviceManager.cpp and notification: featureIndex= in DeviceSession.cpp. Each mouse event produces one of each.

On my machine (Fedora 44, GNOME 50, MX Master 4 over Bluetooth) logitune wrote about 10,000 journal lines in 5 minutes, 99% of the user journal. The journal hit its size cap and kept only 3 days of history. The log files reached 33-51 MB per day, which matches the sizes reported in #112.

Changes

  • LogManager::echoesToStderr() decides what reaches stderr. Warnings and above always do. Debug and info only do when stderr is a terminal, so logitune started from a shell still prints everything, and the log file keeps the full trace either way.
  • QtInfoMsg comes after QtFatalMsg in the enum, so the check compares by name instead of type >= QtWarningMsg.
  • New category logitune.hidpp.raw for the two per-event lines. The debug preset in setLoggingEnabled(true) does not include it. Anyone debugging the protocol can turn it on with QT_LOGGING_RULES="logitune.hidpp.raw.debug=true".
  • The hex string for raw hidraw: is only built when that category is enabled.
  • tests/test_log_manager.cpp covers the stderr matrix and checks that the debug preset leaves the raw category off.

The log file, the Settings toggle and the crash report flow work as before.

Testing

  • logitune-tests: 756 passed, 1 failed (HyprlandDesktopFocus.ActiveWindowEventEmitsFocusSignal, the existing HyprlandDesktopFocus.ActiveWindowEventEmitsFocusSignal fails when a firefox .desktop entry is installed #160, fails the same way on master). logitune-tray-tests 9/9, logitune-qml-tests 72/72.
  • Real hardware: MX Master 4 over Bluetooth, Fedora 44, GNOME 50 on Wayland. I don't have an MX Master 3S, so the hardware smoke test the repo asks for ran on the MX Master 4. After the change the journal gets only the two startup warnings (manifest fetch, unknown device lookup). The log file still records profile application and button setup and no longer records per-event lines. The profile applies on startup as before.

@m-wilkowski
m-wilkowski force-pushed the fix/logging-keep-debug-out-of-journal branch from e2eaffe to 1a6ce07 Compare October 17, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Excessive log size

1 participant