Skip to content

Add dedicated logger for management commands#742

Open
matthew-li wants to merge 4 commits intoupgrade/rocky8-python3.13-developfrom
upgrade/rocky8-python3.13-command-logging
Open

Add dedicated logger for management commands#742
matthew-li wants to merge 4 commits intoupgrade/rocky8-python3.13-developfrom
upgrade/rocky8-python3.13-command-logging

Conversation

@matthew-li
Copy link
Collaborator

Description

**** Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. ****

  • Added a coldfront.commands logger, to be used for management commands, that writes to the console and to a file in monolithic deployments, and only to the console in containerized deployments.
  • Updated critical management commands to:
    • Use the new logger
    • Stop writing to stdout/stderr manually (handled by the logger)
    • Consolidate multi-line logs into one where appropriate
    • Remove unnecessary messaging
    • Add "DRY RUN: " prefixes to messages when in --dry_run mode.
  • Configured structlog to process extra log data.

Type of change

**** Please delete options that are not relevant. ****

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

**** Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. ****

  • Ensure that the test suite passes on GitHub Actions.
  • Test that updated commands write to the expected locations.

PR Self Evaluation

Strikethrough things that don’t make sense for your PR.

  • My code follows the agreed upon best practices
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if needed)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in the appropriate modules
  • I have performed a self-review of my own code

  except when file handler writes to stdout
* Update commands that write to stdout/stderr to use the logger
  (preserving console output in monolithic environments, and only
  writing to the log in K8s-based environments)
* Allow extra log data to be processed by structlog
* Consolidate some multi-line logs into one
* Skip logging when testing in containerized environments
* Stream logs to stdout in CI
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