Skip to content

nut: manage logging#30043

Merged
BKPepe merged 3 commits into
openwrt:masterfrom
danielfdickinson:pr-nut-manage-logging
Jul 19, 2026
Merged

nut: manage logging#30043
BKPepe merged 3 commits into
openwrt:masterfrom
danielfdickinson:pr-nut-manage-logging

Conversation

@danielfdickinson

Copy link
Copy Markdown
Contributor

📦 Package Details

Maintainer: @danielfdickinson
Also notify: @drujd @BKPepe

Description:

NUT (upstream) logging has changed. With the introduction of
NUT_DEBUG_SYSLOG we can set it to "stderr" and have NUT's messages
go to stderr only.

This avoid most duplicate messages when procd sends stderr to syslog.

The reverse (syslog only from NUT) is not a current configuration
option. See the section for NUT_DEBUG_SYSLOG at
https://networkupstools.org/docs/man/nut.conf.html#_directives

This is needed because we use '-FF' so that the daemons remain in the
foreground, which is required for procd to manage them. When using
'-FF' logging behaves differently in NUT than when backgrounded.

Unfortunately, there is still some work to be done upstream to
completely eliminate duplicate messages, so some message continue to
appear twice, though not neccessarily with the same facility.priority.

See also
https://github.com/jimklimov/nut/blob/0c3eed09b89cce1e5c0c65ca03d05b4612371cb8/UPGRADING.adoc#changes-from-282-to-283
and
#29896 (comment)

Conversely, the log messages the initscripts emit are now configured to
emit only to syslog and not to stderr. This avoids duplicates messages
caused by procd's automatic (not configurable) behaviour of sending
the initscript's stderr to syslog, while preserving the syslogid,
facility and priority we want.

Also: Show the PID beside the syslog_id to aid debugging.

And: Where possible prefer the log wrappers to direct logger calls.


🧪 Run Testing Details

  • OpenWrt Version: OpenWrt SNAPSHOT r35431-4f2dc5cc64
  • OpenWrt Target/Subtarget: bcm27xx/bcm2709
  • OpenWrt Device: Raspberry Pi 2 Model B Rev 1.1
  • UPS Model: Trip-Lite ECO550UPS

✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

NUT (upstream) logging has changed. With the introduction of
NUT_DEBUG_SYSLOG we can set it to "stderr" and have NUT's messages
go to stderr only.

This avoid most duplicate messages when procd sends stderr to syslog.

The reverse (syslog only from NUT) is not a current configuration
option. See the section for NUT_DEBUG_SYSLOG at
https://networkupstools.org/docs/man/nut.conf.html#_directives

This is needed because we use '-FF' so that the daemons remain in the
foreground, which is required for procd to manage them. When using
'-FF' logging behaves differently in NUT than when backgrounded.

Unfortunately, there is still some work to be done upstream to
completely eliminate duplicate messages, so some message continue to
appear twice, though not neccessarily with the same facility.priority.

See also
https://github.com/jimklimov/nut/blob/0c3eed09b89cce1e5c0c65ca03d05b4612371cb8/UPGRADING.adoc#changes-from-282-to-283
and
openwrt#29896 (comment)

Conversely, the log messages the initscripts emit are now configured to
emit only to syslog and not to stderr. This avoids duplicates messages
caused by procd's automatic (not configurable) behaviour of sending
the initscript's stderr to syslog, while preserving the syslogid,
facility and priority we want.

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 new commits (logging refactor). Commit messages match their diffs, the log-wrapper argument order is consistent with in-tree conventions, no stray logger -s remains, and CI has not reported failures. One minor consistency nit inline.


Generated by Claude Code

Comment thread net/nut/files/nut-sendmail-notify Outdated
Show the PID beside the syslog_id to aid debugging.

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
Where possible prefer the log wrappers to direct logger calls.

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
@BKPepe
BKPepe merged commit a9f0e9f into openwrt:master Jul 19, 2026
14 checks passed
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.

3 participants