Skip to content

Commit

Permalink
Fix for extra logging output by default by supervisorctl
Browse files Browse the repository at this point in the history
- This adds a loglevel setting for supervisorctl patterned after the
  supervisord loglevel, and it defaults to warn instead of info so that
  it doesn't log the files that are included by default as that's a very
  breaking behavior for anything using the supervisorctl output.
  • Loading branch information
wynnw committed Aug 6, 2024
1 parent 9d74c49 commit ea27cc9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion supervisor/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,7 @@ def __init__(self):
self.configroot.supervisorctl.username = None
self.configroot.supervisorctl.password = None
self.configroot.supervisorctl.history_file = None
self.configroot.supervisorctl.loglevel = 'warn'

from supervisor.supervisorctl import DefaultControllerPlugin
default_factory = ('default', DefaultControllerPlugin, {})
Expand All @@ -1688,14 +1689,16 @@ def __init__(self):
self.add("username", "supervisorctl.username", "u:", "username=")
self.add("password", "supervisorctl.password", "p:", "password=")
self.add("history", "supervisorctl.history_file", "r:", "history_file=")
self.add("loglevel", "supervisorct.loglevel", "e:", "loglevel=",
logging_level, default="warn")

def realize(self, *arg, **kw):
Options.realize(self, *arg, **kw)
if not self.args:
self.interactive = 1

format = '%(levelname)s: %(message)s\n'
logger = loggers.getLogger()
logger = loggers.getLogger(self.loglevel)
loggers.handle_stdout(logger, format)
self._log_parsing_messages(logger)

Expand Down Expand Up @@ -1750,6 +1753,8 @@ def read_config(self, fp):
section.history_file = None
self.history_file = None

section.loglevel = logging_level(parser.getdefault('loglevel', section.loglevel))

self.plugin_factories += self.get_plugins(
parser,
'supervisor.ctl_factory',
Expand Down

0 comments on commit ea27cc9

Please sign in to comment.