RailsSemanticLogger::Rack::Logger.logger.level = :info # useful for remaining log like "[Rack::Log] Started..." SemanticLogger.clear_appenders! im = nil # Zeitwerk reload message Rails.autoloaders.main.on_load('ApplicationController') do SemanticLogger[:zeitwerk].debug('reload!') im = Semantic::InstrumentationManager.new end Rails.configuration.after_initialize do Rails.logger.name = 'error_trap' Semantic::InstrumentationManager.clear bootstrap = [{ kind: :restored, constant: 'ACTION_VIEW', type: :boolean, old_value: false, new_value: true }, { kind: :restored, constant: 'ACTION_CONTROLLER', type: :boolean, old_value: false, new_value: true }] im ||= Semantic::InstrumentationManager.new im.process(bootstrap) ActiveSupport::Notifications.subscribe('rolling.live_constant') do |event| puts event.payload[:changes].inspect im.process(event.payload[:changes]) rescue StandardError => e puts e end end