Skip to content

Debug keys persist across server restarts even when "Persist debug settings" is off #2422

@dirkwa

Description

@dirkwa

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:

  1. The ~/.signalk/debug file, controlled by the "Persist debug settings over server restarts" toggle in Server Log.

  2. The enableDebug field in each plugin's config file (e.g. plugin-config-data/freeboard-sk.json). This gets set to true when you activate a debug key via the Server Log dropdown — and because plugins.ts calls app.logging.addDebug(plugin.packageName) on every plugin start when enableDebug is 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions