-
-
Notifications
You must be signed in to change notification settings - Fork 188
Description
Hi, thank you for all the great work on Signal K server!
While working on the R19 admin UI I noticed some confusing behaviour around debug logging.
What I found
There appear to be two separate mechanisms that persist debug keys across restarts:
-
The
~/.signalk/debugfile, controlled by the "Persist debug settings over server restarts" toggle in Server Log. -
The
enableDebugfield in each plugin's config file (e.g.plugin-config-data/freeboard-sk.json). This gets set totruewhen you activate a debug key via the Server Log dropdown — and becauseplugins.tscallsapp.logging.addDebug(plugin.packageName)on every plugin start whenenableDebugis true, the keys come back on every restart regardless of the "Persist" toggle.
The result is that users who select debug keys via the Server Log dropdown and then turn "Persist" off (or never turn it on) are surprised to find those keys still active after a restart.
Small separate bug
In logging.js, fs.unlinkSync(debugPath) is called unconditionally when turning "Persist" off. If the debug file doesn't exist this throws ENOENT, which prevents rememberDebug from being set to false and the DEBUG_SETTINGS event from being emitted. I have a one-line fix for this in a PR already.
Question
Is the enableDebug flag in plugin config intentional as a separate persistence mechanism, independent of the "Persist" toggle? If so, should the UI make this clearer? Or should the two mechanisms be consolidated?
Also wondering: since debug keys are now effectively persisted at the plugin config level anyway, is the "Persist debug settings over server restarts" toggle in Server Log still serving a purpose? Could it be removed to simplify the UI?
Happy to help with a fix once I understand the intended design. Thanks!