All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
- Require
semantic_loggerv5.1 or greater, keeping the two gems in lock step. - Boot: a log file that cannot be opened is now caught during boot. Semantic Logger v5.1 opens the
file appender's log file when it is created, so a bad path or insufficient permissions raises from
SemanticLogger.add_appenderand the engine's fallback (log to STDERR at:warn) runs as intended. Previously the failure surfaced asynchronously on the appender thread and the app booted against a silently broken appender. As a side effect the log file is now created as soon as the appender is added, even if nothing has been logged yet, matching the standard Rails logger. - Boot: the rescue no longer reports a log file path problem when the failure came from the appenders block, where no path is involved. It now emits an accurate message per branch.
- ActionCable: fix an
ArgumentErrorfromTaggedLoggerProxywhen the wrapped logger is a plain RubyLogger, which accepts only a single progname argument. The v4.9 change always forwarded the full(message, payload, exception)signature, breakingActionCable::Connection::TestCasetests such ashave_rejected_connection. The extra arguments are now only forwarded to a logger method that can accept them. Fixes #317. - Sidekiq: officially support Sidekiq 7 and 8, and test both in CI (Sidekiq 7.x on the Rails 7.2 appraisal, Sidekiq 8.x on the Rails 8.0 and 8.1 appraisals).
- Sidekiq: remove support for Sidekiq 4, 5, and 6. These versions predate the gem's Rails 7.2 /
Ruby 3.2 floor and were untested; the
Sidekiq::Logging/ server middleware patches, the pre-6.5job_loggerwiring, the Sidekiq 5Workerfallback, and the pre-7.1.6 error-handler branches are gone. - Sidekiq: honor Sidekiq 8's
logged_job_attributessetting, so additional job attributes can be added to the logging context (defaults tobidandtags, matching Sidekiq). - Sidekiq: honor Sidekiq 8's
skip_default_job_loggingsetting as an alternative toRailsSemanticLogger::Sidekiq::JobLogger.perform_messages = falsefor suppressing theStart #perform/Completed #performmessages. - Add a
changelog_urito the gem metadata, so RubyGems links to this file. Thanks to Philip Hallstrom. - Remove the vestigial
sprockets < 4.0development pin, which resolved to sprockets 1.0.2 with nosprockets-railsand therefore provided no Rails integration.
- Bump the major version to keep it in lock step with Semantic Logger v5, and require
semantic_logger >= 5.0. - Appenders: add a
config.rails_semantic_logger.appenders do |appenders| ... endblock to declare log destinations by context. The method names the context (when) and the args name the destination (where):addis always created at init,add_serverapplies when serving requests (defaults to$stdout), andadd_consoleapplies inside the Rails console (defaults to$stderr). This replaces the single defaultlog/<env>.logfile appender plus theformat/filter/ap_optionsoptions. - Appenders: deprecate the
format,ap_options,filter,console_logger, andadd_file_appenderoptions in favor of the appenders block. They still work but warn via the deprecator and will be removed in v6. - Forking: rely on Semantic Logger v5's automatic reopen-after-fork (the
Process._fork/Process.daemonhook reopens appenders in the child, once per process). Remove the now-redundant manual reopen hooks for Passenger, Resque, Spring, and SolidQueue, the rack/rackupdaemonize_appoverrides, and the DelayedJob plugin. Apps that opt out withSemanticLogger.reopen_on_fork = falseare responsible for reopening themselves. - ActionMailer: match Rails'
subscribe_log_levelgating so thedeliverandprocessevents are only emitted when the logger is at debug level, and logprocessat debug to match upstream. - ActionMailer: include the full encoded message (
mail) in thedeliverpayload, mirroring Rails' debug-level mail dump. - ActionMailer: remove dead code from the log subscriber (the inapplicable
log_arguments?branch and an unreachable, self-recursive date-string branch). - ActionView: add
gc_timeto therender_template,render_partial, andrender_collectionpayloads, matching the GC timing Rails now reports. - ActionView: emit a
Rendered layoutcompletion event (withduration,allocations, andgc_time) to mirror Rails'render_layoutsubscriber. The upstream ActionView log subscriber is identical across Rails 7.2 / 8.0 / 8.1, so no version-specific behavior is required. - ActionView: log under the name
ActionView::Base(viaActionView::Base.logger) instead ofActionView, for consistency with theActiveRecord::Base,ActiveJob::Base,ActionMailer::Base, andActionController::Baselogger names. - ActiveJob: add the
enqueue_retry,retry_stopped, anddiscardevents (present in Rails since before 7.2 but never reimplemented here, so they previously produced no output). - ActiveJob: add the Rails 8.1 Continuation events (
interrupt,resume,step_skipped,step_started,step). The handlers are defined unconditionally; on Rails < 8.1 those notifications are never emitted, so no version-specific behavior is required. - ActiveJob: fall back to
job.enqueue_errorwhen noexception_objectis present, matching Rails, so a failed enqueue is no longer logged as a success. - ActiveJob: add the
abortedbranch toperform, logging a haltedbefore_performcallback as an error to match upstream. - ActiveJob: add
enqueued_atandscheduled_atto the event payload (when applicable), plusexecutions/waiton retry events andstep_name/step_cursoron Continuation step events. - ActiveRecord: handle the
strict_loading_violationevent (previously dropped entirely when our subscriber replaced Rails'), emitting the violation message plus a structured payload (owner,association, andclassfor non-polymorphic reflections). - ActiveRecord: add
lock_waitto thesqlpayload for async queries, matching Rails. - ActiveRecord: only set
cachedin thesqlpayload when the result was served from the query cache, instead of writingcached: nilon every query. - ActiveRecord: filter sensitive bind values via Rails' own
ActiveRecord::Base.inspection_filter(derived fromconfig.filter_parameters), replacing the previous partial filter that only handled a single leading Regexp. The upstream subscriber is identical across Rails 7.2 / 8.0 / 8.1, so no version-specific behavior is required. - Warn when a logger setting is configured too late to take effect. Settings consumed while the
logger is built (the appenders block,
filter,format,ap_options,add_file_appender,semantic,replace_sidekiq_logger,replace_solid_queue_logger) now print a warning when changed fromconfig/initializers/*, which Rails loads after the logger is initialized. Settings consumed at the end of initialization (started,processing,rendered,quiet_assets,action_message_format) warn when changed after the application has booted. Configure logging inconfig/application.rborconfig/environments/<env>.rb. Addresses #245. - ActionController: restore the
processingoption, which had stopped taking effect. TheProcessingmessage was hardcoded to:debug; it is now logged at:infoagain whenconfig.rails_semantic_logger.processingis true, matching thestartedandrenderedoptions. - Remove the long-deprecated and unused
named_tagsoption. Supply a Hash toconfig.log_tagsinstead. - Metrics (prototype): emit a Semantic Logger
metricalongside each log entry that is logged at:info,:warn, or:error, so durations and event counts can be sent to a metrics backend. Names followrails.<component>.<event>, dropping theaction_/active_prefix (e.g.rails.controller.process_action,rails.view.render.template,rails.job.perform,rails.mailer.deliver,rails.solid_queue.start_process). Debug-level entries (e.g. ActiveRecordsql) carry no metric. These metric names are a prototype and subject to change in a future release.
- Add a toggle to prevent replacement of the Sidekiq logger (
replace_sidekiq_logger). - Add configuration to toggle off Sidekiq "perform" messages.
- Sidekiq: log the replacement error handler's context at
:infoinstead of:warn, matching upstream Sidekiq's default handler and removing duplicate noise (the exception itself is already logged at:errorby the Job Logger). Fixes #271. - Handle binary strings in
EventFormatter#format. Fixes #284. - Fix
Startedlog line under Rails 7.1, with backward compatibility back to Rails 7.2. Fixes #281. - Fix #282. Thanks @navidemad.
- Add support for Rails 8.1.
- Move the bypass of double-counted query time methods to Rails 8.0.3 to catch the known double-counting issues reported in that version. Resolves #273.
- Handle
ActiveRecord::RuntimeRegistry.sql_runtimeprivate API move, and return early when setting runtime on Rails > 8.1. - Avoid crashing in API-only (no assets) mode.
- Respect
action_dispatch.log_rescued_responses. - Auto-detect SolidQueue and add
SolidQueue.on_startsupport. - Change how Rack requests are instrumented, and unsubscribe all listeners on Rails >= 7.1.
- Include
async: trueon async queries, with a workaround for a Rails 8 async query test issue. - Fix the Rails version check in the ActiveRecord log subscriber.
- Allow customizing the message of an action log (
action_message_format). - Ensure filter params are still checked when cast to a regex, and are not revealed in SQL.
- Add missing conditionals to
ActionDispatch::DebugExceptions#log_error. - Replace Awesome Print with Amazing Print.
- Add CI against Rails 8.0.
- Fix Sidekiq cross-version issues; add support for Sidekiq 7.2, 7.1.6, and 7.3.0.
- Initialize the Sidekiq 6 error handler, and only replace the default Sidekiq error handler when present.
- Use Sidekiq configuration where possible to override Sidekiq logging.
- Fix the Sidekiq error handler not taking effect; duplicate the fixes to the Sidekiq v4 patches.
- Refine the metrics that are generated.
- Add tests and support for Sidekiq 7, with a unified Sidekiq patch file.
- Avoid false positives during Resque detection.
- Ensure the load order of the optional Rackup dependency.
- Test the
ActionDispatch::DebugExceptionsextension and fix a couple of deprecations.
- Add a test matrix entry for Rails 7.1.1 covering the
ActiveSupport::LogSubscriber#silenced?patch, and only enable thesilenced?patch for 7.1.1. - Fix Ruby 3.2.2 and Rails 6.1 compatibility in the test suite.
- Fix Rack server deprecation in Rack 3.
- Add support for Rails 7.1.
- Fix
log_argumentsof the mailer not working properly. - Handle a nil logger in
ActiveJob::Logging. - Extend
#enqueueand#enqueue_atin the ActiveJob subscriber to handle errors and aborts. - Remove the
undef :broadcastoverride sinceActiveSupport::Loggerdropped it.
- Add support for Sidekiq 7.x.
- Add Ruby 3.2 to the CI matrix.
- Do not process the ActionController payload if params is not a Hash.
- Use
finish_with_stateinsideRailsSemanticLogger::Rack::Logger. - Require Rails subscribers only if defined.
- Avoid 2.7+ syntax that breaks compatibility with earlier Ruby versions.
- Add ActionMailer logging with formatted args, and log exceptions correctly.
- Fix rendering of bind values for Rails 7.
- Support Sidekiq < 7.
- Only undefine
Rails::Server#log_to_stdoutif it is defined.
- Test with Ruby 3.1.
- Avoid a warning when attempting to add a second console appender.
- Add Rails 7 appraisals.
- Prepare for Semantic Logger v5, including direct access to appenders.
- Make it configurable whether to add the stderr logger when running a Rails console, and do not auto-add the console logger when one already exists.
- Use the legacy
thread_safegem for older versions of active_model_serializers. - Eliminate method redefinition and
:: in void contextwarnings.
- Add Ruby 2.7 with Rails 6.1 to the CI test suite.
- Set the minimum Ruby version to 2.5.
- Fix the bind column name for Rails 6.1.4.
- Silence method redefinition warnings.
- Reopen Semantic Logger when running Rails as a Rack daemon. Fixes #69.
- Also log to stderr when running in a Rails console. Fixes #83.
- Log the payload when an ActiveJob
performraises an exception. - Do not use
nilas a payload key.
- Add missing caching information to logs.
- Fix notification payload params absence.
- Use
request.remote_ip. Fixes #128. - Take Rails'
relative_url_rootinto account when filtering Rack asset requests.
- Test with Ruby 3.
- Add allocations to the payload for controller, view, and ActiveRecord logs.
- Add an option to disable logging for any ActiveJob jobs with sensitive arguments.
- Handle a nil bound key. Fixes #121.
- Omit request and response from output.
- Add support for Rails 6.1.
- Switch to Amazing Print.
- Use the correct namespace. Fixes #108.
- Swap the ActiveJob log subscriber safely.
- Use
Sidekiq.loggerwhenSidekiq::Loggingis unavailable. - Fix unsubscribing notifications in Rails 6.
- Check for the specific method existence for the Spring
after_fork.
- Fix Rails 6 SQL logging with query cache.
- Add proper informative ActiveJob events subscription, skipping subscription for older Rails versions.
- Remove minitest-rails to support the Rails 6 beta.
- Remove the fork workaround now that Semantic Logger v4.4 handles it.
- Use a class with default values. Fixes #84.
- Fix the scope for
ActiveRecord::Base.
- Add support for Rails 5.2 and Rails 3.2.
- Add support for Delayed Job, with a plugin that reopens the log file
after_fork. - Log the source line from which the SQL query was submitted.
- Inspect the file param to prevent
to_jsonfrom logging the entire file. - Remove Rails monkey-patching where feasible, and replace
Rails::Rack::Logger. - Move Rails patches to
after_initialize. Fixes #50. - Fall back to
ActionController::Base.loggerwhen the logger returns nil. Fixes #62, #49. - Keep calling an unused method so that Devise will work. Fixes #46.
- Only disable Sprockets asset quieting when logging is semantic.
- Fix bind variable logging, including attributes with several values.
- Remove the Concurrent Ruby logger replacement.
- Fix non-colorized log output. Fixes #41.
- Allow the filter to be set via configuration. #19.
- Switch to Rails version constants to support Rails 5.0.3.
- Fix the log subscriber monkey patch for Rails 5.0.3.
- Use
config.log_tagsfor named tags.
- Make backward compatible with Rails 4.2. Fixes #38.
- Honor
ActionController::Base.enable_fragment_cache_logging. - Support named tags in the Rails Rack logger.
- Fix
log_subscriberHash#except.
- Use Appraisal to manage gemsets.
- Fix ActiveRecord logging in Rails 5.1.
- Update for Semantic Logger v4 (changed payload).
- Give Rack its own logger.
- Quiet assets by adding a filter to the
Rails.logger. Fixes #48. - Replace the Mongo logger.
- Replace ActionCable
#tag, not#tag_logger. Fixes #29.
- Replace the Mongo logger and update tests.
- Include
SemanticLogger::LoggableinActiveModelSerializers::SerializableResource.
- Add support for ActiveModelSerializers.
- Strip params from the path since they are already in the payload.
- Fix missing info in Rails 5. Fixes #16.
- Switch to a Rails Engine, with an initial framework for tests.
- Support Controller
append_info_to_payload; switch from a whitelist to a blacklist approach. - Add a config option to disable the default Rails log file
(
config.rails_semantic_logger.add_file_appender). - Add Travis CI testing for Rails 3.2, 4.1, 4.2, and 5.0.
- Correctly handle
config.colorize_logging == false. - Handle the Rails 5 Beta 3 rename of the ActiveJob
#tagmethod to#tag_logger.
- Patch Rails so that it logs semantic data, and add configuration options.
- Patch the ActiveRecord log subscriber.
- Patch the ActionCable formatter.
- Enable one-line logging by default in production.
- Fix
Action::Controller.log_error.
- Fix ActionCable logger replacement, which stores its logger inside an instance of a configuration class. Fixes #10.
- Update to Semantic Logger v3.
- Replace Rails instance loggers to support inheritance.
- Add stdout logging when running a Rails server configured to log to stdout. Fixes #7.
- Replace the Sidetiq logger if present.
- Set
config.semantic_loggertoSemanticLogger. - Move documentation to GitHub Pages.
- Add support for the Spring gem.
- Completely remove the Rails logger initializer so that the
:tracelevel works. Fixes #5. - Add a Sidekiq logger and detect older Resque versions. Confirmed working with Rails 3 and Rails 4.
- Fix an issue where Rails 4 was bypassing Semantic Logger in the controllers.
- Replace the Resque logger if Resque is loaded, with support for process forking via
after_forkcallbacks. Fixes #2. - Add Syslog appender examples.
- Initial release: move Rails dependencies out of Semantic Logger and into this gem.
- Add tagged logging and colorized logging.
- Document Rails 4 support.