Skip to content

feat: dynamic log level update from patch.cfg without container restart#413

Open
rippleitinnz wants to merge 1 commit into
mainfrom
fix/dynamic-log-level-from-patch-cfg
Open

feat: dynamic log level update from patch.cfg without container restart#413
rippleitinnz wants to merge 1 commit into
mainfrom
fix/dynamic-log-level-from-patch-cfg

Conversation

@rippleitinnz
Copy link
Copy Markdown
Contributor

@rippleitinnz rippleitinnz commented May 19, 2026

Problem

log.log_level in patch.cfg is written correctly by the contract upgrade
mechanism but has no effect on the running node. hplog::init() sets the
plog severity once at startup — there is no code path to update it while
hpcore is running.

This means operators managing Evernode clusters have no way to change log
verbosity on external hosts where they don't control the container lifecycle.
A full container restart is required, which is not possible on leased instances.

Fix

In apply_patch_config(), after updating cfg.log.log_level and
cfg.log.log_level_type, call plog::get()->setMaxSeverity() with the
new severity level. This takes effect immediately on the next log statement
without any restart.

The plog library supports this via Logger::setMaxSeverity() — it is
thread-safe and designed for runtime severity changes.

Files changed

  • src/conf.cpp — added hplog.hpp include and dynamic severity update in apply_patch_config()

Testing

Tested on a live 14-node Evernode cluster. Log level change via patch.cfg
update takes effect within one consensus round (~8-10 seconds) without any
container restart.s built-in setMaxSeverity() API which is thread-safe and takes effect immediately on the next log statement.

Sibling PRs

This is part of a series making some hpcore config fields dynamically updatable from patch.cfg:

These three PRs should ideally be reviewed and merged together. PRs #414 and #415
share the for_each_session() template added to comm_server.hpp, and all three
follow the same pattern in apply_patch_config() in conf.cpp.

When log.log_level is present in patch.cfg, apply_patch_config() now
updates the live plog logger severity via plog::get()->setMaxSeverity()
in addition to persisting the change to hp.cfg and the runtime cfg struct.

Previously log level was only read at startup (hplog::init()) and could
not be changed on a running node without a container restart. This meant
operators had no way to change log verbosity on external Evernode hosts
where they don't control the container lifecycle.

The fix uses plog's built-in setMaxSeverity() API which is thread-safe
and takes effect immediately on the next log statement.
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.

1 participant