From 67d1f0d9f961be7cfa9738f69a1133f816c9c884 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 22 Oct 2025 15:05:56 +0100 Subject: [PATCH 1/2] fix(test): correct log level and logger behaviour - Sets log level from environment, defaulting to info. - Ensures level is applied before logger initialisation. - Uses structured logger only at debug to reduce test noise. - Removes duplicate level assignment and debug default. --- config/environments/test.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config/environments/test.rb b/config/environments/test.rb index 6397628..9ed1590 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -36,15 +36,18 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + # Set the log level to the value of the LOG_LEVEL environment variable, or 'info' if not set + config.log_level = ENV.fetch('LOG_LEVEL', 'info').to_sym + # Tag rails logs with useful information config.log_tags = %i[subdomain request_id request_method] + # When sync mode is true, all output is immediately flushed to the underlying # operating system and is not buffered by Ruby internally. $stdout.sync = true + # Log the stdout output to the Epimorphics JSON logging gem - config.logger = JsonRailsLogger::Logger.new($stdout) - # Set the log level to the value of the LOG_LEVEL environment variable, or 'debug' by default - config.log_level = ENV.fetch('LOG_LEVEL', 'debug').to_sym + config.logger = JsonRailsLogger::Logger.new($stdout) if config.log_level == :debug # API location can be specified in the environment # But defaults to the dev service From bad9501353c00d99efe9cc27f81c13537a6aef11 Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Wed, 22 Oct 2025 15:20:40 +0100 Subject: [PATCH 2/2] docs: revises change log; notes test logging - Adopts a standardised format and versioning to improve readability. - Documents that tests respect the configured log level to reduce noise when not debugging. - Normalises wording and structure across historical entries. - Adds an unreleased section for upcoming changes. --- CHANGELOG.md | 199 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 122 insertions(+), 77 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba87308..da6b6bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,80 +1,125 @@ -# Standard Reports UI: change log - -## Unreleased - -## 2.2.1 - 2025-08 - -- Updated LR Common Styles gem to continue to address security issues -- Upgrades dependencies, including Rails, to address security issues -- Improved environment configs for logging and error tracking -- Updates tooling and lock files for smoother development -- Clarified and reorganise comments and messaging across scripts -- Adds documentation for automation and workflow setup -- Commented out non-essential automation steps for clarity - -## 2.2.0 - 2025-07 - -- Update gem dependencies for compatibility and performance -- Refactor string handling with a new helper method -- Ensure consistent styling for disabled buttons -- Update methods for clearer naming and logic flow -- Improve bundler command execution and error logging - -## 2.1.2 - 2025-07 - -- Updates to Ruby 3.4.4 and Alpine 3.22 in Docker setup -- Introduces environment helper for enhanced UI context -- Refines asset management in build processes -- Upgrades styling components for consistency -- Remove deprecated uglifier dependency -- Add dotenv and byebug for dev/test environments -- Selectively apply RuboCop rules with annotations -- Bump `lr_common_styles` gem version for GA Tag updates -- Add support for custom docker `RUN_VAR`s - -## 2.1.1 - 2025-06 - -- Hotfix: Ensuring current data contains the expected geographic boundaries -- fix: rReplacing hard coded lists with external data files -- refactor: Adding error handling for JSON loading -- refactor: Refining naming conventions to adhere to coding standards - -## 2.1.0 - 2025-05 - -- Implements structured logging using JSON format, improving readability and - integration with logging services. -- Configures log level via environment variable. -- Adds pre-commit and post-commit hooks for code quality checks and testing. -- Introduces development environment configuration and Procfile for easier local - setup. -- Reconfigures Sentry for better error tracking in development and production - environments. -- Updates dependencies and adds new gems to improve application functionality. -- Updates rubocop and adjusts helpers and models via rubocop. - -## 2.0.2 - 2024-12 - -- (Jon) Myriad of tweaks to ensure variables either fail quietly via safe - navigation or are set to a default value to prevent errors in the application -- (Jon) Updated the error template path to use `Rails.public_path` as well as - contain the `html` extension to ensure the correct template is rendered -- (Jon) Improves error metrics reporting to ensure that logging always happens - with the appropriate severity depending on the exception status while reducing - the types of errors that can trigger a an error metric and therefore a - notification in slack - [GH-149](https://github.com/epimorphics/hmlr-linked-data/issues/149) - -## 2.0.1 - 2024-12 - -- (Bogdan) Fixed a bug that was causing an internal application error in - `ReportManagerApi` - -## 2.0.0 - 2024-12 - -- (Bogdan) Updated all gems by regenerating `Gemfile.lock` -- (Bogdan) Upgraded alpine to `3.20` -- (Bogdan) Upgraded rails to `7.2.2` -- (Bogdan) Upgraded ruby to `3.3.5` +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Changed + +- Test logging adjusted to respect log level and reduce logs displayed unless + debugging + +## [2.2.1] - 2025-08 + +### Changed + +- LR Common Styles gem updated to continue to address security issues +- Dependencies upgraded, including Rails, to address security issues +- Environment configs improved for logging and error tracking +- Tooling and lock files updated for smoother development +- Comments and messaging across scripts clarified and reorganised + +### Added + +- Documentation for automation and workflow setup + +### Removed + +- Non-essential automation steps for clarity + +## [2.2.0] - 2025-07 + +### Changed + +- Gem dependencies updated for compatibility and performance +- String handling refactored with a new helper method +- Consistent styling ensured for disabled buttons +- Methods updated for clearer naming and logic flow +- Bundler command execution and error logging improved + +## [2.1.2] - 2025-07 + +### Changed + +- Ruby updated to 3.4.4 and Alpine to 3.22 in Docker setup +- Environment helper introduced for enhanced UI context +- Asset management refined in build processes +- Styling components upgraded for consistency +- RuboCop rules selectively applied with annotations +- `lr_common_styles` gem version bumped for GA Tag updates + +### Added + +- dotenv and byebug for dev/test environments +- Support for custom docker `RUN_VAR`s + +### Removed + +- Deprecated uglifier dependency + +## [2.1.1] - 2025-06 + +### Fixed + +- Current data ensured to contain the expected geographic boundaries +- Hard coded lists replaced with external data files + +### Changed + +- Error handling added for JSON loading +- Naming conventions refined to adhere to coding standards + +## [2.1.0] - 2025-05 + +### Added + +- Structured logging implemented using JSON format, improving readability and + integration with logging services +- Log level configuration added via environment variable +- Pre-commit and post-commit hooks added for code quality checks and testing +- Development environment configuration and Procfile introduced for easier local + setup +- New gems added to improve application functionality + +### Changed + +- Sentry reconfigured for better error tracking in development and production + environments +- Dependencies updated +- Rubocop updated and helpers and models adjusted via rubocop + +## [2.0.2] - 2024-12 + +### Changed + +- Variables ensured to either fail quietly via safe navigation or are set to a + default value to prevent errors in the application +- Error template path updated to use `Rails.public_path` as well as contain the + `html` extension to ensure the correct template is rendered +- Error metrics reporting improved to ensure that logging always happens with + the appropriate severity depending on the exception status while reducing the + types of errors that can trigger an error metric and therefore a notification + in slack [GH-149](https://github.com/epimorphics/hmlr-linked-data/issues/149) + +## [2.0.1] - 2024-12 + +### Fixed + +- Bug fixed that was causing an internal application error in `ReportManagerApi` + +## [2.0.0] - 2024-12 + +### Changed + +- All gems updated by regenerating `Gemfile.lock` + - Alpine upgraded to `3.20` + - Rails upgraded to `7.2.2` + - Ruby upgraded to `3.3.5` + +--- ## 1.6.0 - 2024-10