Support debug level passed via ups.conf and -F/-B explicit fore/back-grounding mode for NUT daemons#683
Merged
jimklimov merged 36 commits intonetworkupstools:masterfrom Feb 16, 2022
Merged
Conversation
This was referenced Jan 25, 2021
This was referenced Nov 14, 2021
…bal vs nut_debug_level_driver vs ultimately used nut_debug_level
…g_min' This merge unites two similarly targeted PRs: Closes: networkupstools#683 Closes: networkupstools#349
…nt, and that -D/-d only default to foregrounding now (can be overridden)
… and that -D only defaults to foregrounding now (can be overridden)
…nd that -D only defaults to foregrounding now (can be overridden)
This was referenced Feb 11, 2022
Member
Author
|
Testing with Here driver-level setting takes precedence over global-level one, and over the (lower) debug set on CLI (pass-through from A higher level may still be specified on command line and takes effect: With driver-level (and yielding to larger CLI values: |
Member
Author
|
Similarly, checked for other daemons, e.g. (second line probably comes from child process arrangements? though there shouldn't be a child in foreground mode? Just privilege drop - and maybe a re-parse?) ...and |
This was referenced Feb 16, 2022
This was referenced Jan 2, 2023
5 tasks
-F/-B explicit fore/back-grounding mode for NUT daemons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There were previously attempts to arrange debugability of "production-mode" start-up of NUT daemons vs. their forced foregrounding in case of
-Doptions present in command line. As I recently needed to inspect how driver services start and why they failed in my case, I took another attempt in this area, and came up with the proposed solution (just for drivers so far) to:separate the
-DCLI option vs. explicit option to foreground-For background-Bthe daemon; if neither of the latter options is set, defaults are as before (go background unless debugged);** Names/shortcuts/help-text of the options can be subject to peer review, to have some values acceptable for consistently named options across the board, if we extend this approach to other NUT daemons;
allow to set the default (driver) debugging level in either global or driver-level section of
ups.conf; if both are set, the driver-level setting takes precedence; either of these may be set to a zero or positive integer;** unlike command-line
-Dthis setting does not require foregrounding (-Fcan be explicitly passed if desired) so the service daemons stay backgrounded by default as before;** this allows to see debug messages in original service log, with the service units (access rights, environment, etc.) otherwise not modified - which often corrupts or complicates command-line troubleshooting;
** a more arguable corollary: since we do not currently have a way to disable debugging (set
0level) I chose to require that the valid option inups.conf(global section, or preferably driver-level value) specifies the minimum debugging level applied to the daemon -- if the command-line invocation specifies less-Dflags, the practically applied level would be the one in the config.*** Per peer review, this design choice (and config option name) can be amended; at the very least with current implementation a CLI caller can easily set a minimum of
-D(==1) level instead, and something in CLI processing would need to be invented to reset a"-D == 0"level.(see also #123 and #821 and #349)