Skip to content

Commit

Permalink
Do not use the file logger at all in python commands.
Browse files Browse the repository at this point in the history
The logger only uses the default Streamhandler now which outputs to stderr.
  • Loading branch information
ndokos committed Mar 16, 2023
1 parent 761445c commit fd037e7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
6 changes: 0 additions & 6 deletions agent/config/pbench-agent-default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ pbench_log = %(pbench_run)s/pbench.log
# RPM requirement mode: strict vs relaxed
rpm_requirement_mode = strict

[logging]
logger_type = file
# # "log_dir" is only considered when "logger_type" is set to "file"; And by
# # default the log file directory is the "pbench_run" directory.
# log_dir =

[results]
user = pbench
host_info_uri = pbench-results-host-info.versioned/pbench-results-host-info.URL002
Expand Down
7 changes: 0 additions & 7 deletions lib/pbench/agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ def __init__(self, cfg_name):
)
self.pbench_lib_dir = self.pbench_install_dir / "lib"

if self.logger_type == "file" and self.log_dir is None:
# The configuration file has a logging section configured to use
# "file" logging, but no log directory is set. We'll set the log
# directory to be the directory of the legacy ${pbench_log} value
# determined above.
self.log_dir = str(self.pbench_log.parent)

try:
self.ssh_opts = self.get("results", "ssh_opts", fallback=DEFAULT_SSH_OPTS)
except (NoOptionError, NoSectionError):
Expand Down
7 changes: 1 addition & 6 deletions lib/pbench/agent/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ def __init__(self, context):
)
click.get_current_context().exit(1)

# log file - N.B. not a directory
self.pbench_log = self.config.pbench_log
if self.pbench_log is None:
self.pbench_log = self.pbench_run / "pbench.log"

self.pbench_install_dir = self.config.pbench_install_dir
if self.pbench_install_dir is None:
self.pbench_install_dir = "/opt/pbench-agent"
Expand All @@ -71,7 +66,7 @@ def __init__(self, context):
self.pbench_bspp_dir = self.pbench_install_dir / "bench-scripts" / "postprocess"
self.pbench_lib_dir = self.pbench_install_dir / "lib"

self.logger = setup_logging(debug=False, logfile=self.pbench_log)
self.logger = setup_logging(debug=False, logfile=None)

self.ssh_opts = os.environ.get("ssh_opts", self.config.ssh_opts)
self.scp_opts = os.environ.get("scp_opts", self.config.scp_opts)
Expand Down

0 comments on commit fd037e7

Please sign in to comment.