Skip to content

Add logging stream to file#2039

Merged
GernotMaier merged 8 commits intomainfrom
logging-to-file
Feb 13, 2026
Merged

Add logging stream to file#2039
GernotMaier merged 8 commits intomainfrom
logging-to-file

Conversation

@GernotMaier
Copy link
Copy Markdown
Contributor

Reproducibility requires (among other things) logging information. Add a new logging stream to a file when running simtools applications.

All simtools logging is automatically written to a log file through the application startup mechanism.

Two options:

  • (default) log file is generated in output_path as <tool-name-UTC-datetime.log> file
  • --log_file as configuration parameter

@GernotMaier GernotMaier self-assigned this Feb 11, 2026
@GernotMaier GernotMaier marked this pull request as ready for review February 11, 2026 16:16
@GernotMaier GernotMaier requested a review from Copilot February 11, 2026 16:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds file-based logging for simtools applications to support reproducibility, with an auto-generated default log file in output_path and an optional user-specified --log_file.

Changes:

  • Add setup_logging()/get_log_file() to configure both console and file logging during application startup.
  • Extend CLI/config plumbing to carry an application_label and accept a --log_file argument.
  • Update tests and resources to reflect the new logging behavior and a renamed afterpulsing ECSV resource.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/simtools/application_control.py Adds centralized logging setup and default log-file path generation, integrated into startup_application().
src/simtools/configuration/commandline_parser.py Adds --log_file CLI argument for explicit log file path configuration.
src/simtools/configuration/configurator.py Ensures application_label is present in config for log file naming.
src/simtools/testing/log_inspector.py Adjusts ignore patterns to reduce false positives from new/changed log output.
src/simtools/visualization/plot_array_layout.py Suppresses adjustText logging noise.
src/simtools/data_model/metadata_collector.py Removes a warning that could add noise to logs.
tests/unit_tests/test_application_control.py Refactors/extends unit tests for logging setup, log-file selection, and redaction.
tests/resources/plot_single_pe_config_from_ecsv_file.yml Updates resource reference to renamed afterpulsing ECSV file.
tests/resources/Afterpulsing-probability-with-uncertainties.ecsv Adds new ECSV resource file.
docs/changes/2039.feature.md Documents the new “log to file” feature.

@ctao-sonarqube
Copy link
Copy Markdown

ctao-sonarqube bot commented Feb 12, 2026

Quality Gate failed Quality Gate failed

Failed conditions
1 New issue

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE SonarQube for IDE

@GernotMaier
Copy link
Copy Markdown
Contributor Author

@EshitaJoshi - I am not going to fix these to issue reported by SonarQube. I think they make the code more difficult to read and I have started the discussion in DPPS to remove those to criteria.

Copy link
Copy Markdown
Collaborator

@EshitaJoshi EshitaJoshi left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@GernotMaier
Copy link
Copy Markdown
Contributor Author

Thank you @EshitaJoshi

@GernotMaier GernotMaier merged commit e46cb0d into main Feb 13, 2026
16 of 22 checks passed
@GernotMaier GernotMaier deleted the logging-to-file branch February 13, 2026 08:44
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.

4 participants