module ActiveSupport::Deprecation::Behavior
def behavior
def behavior @behavior ||= [DEFAULT_BEHAVIORS[:stderr]] end
def behavior=(behavior)
# custom stuff
ActiveSupport::Deprecation.behavior = ->(message, callstack) {
ActiveSupport::Deprecation.behavior = MyCustomHandler
ActiveSupport::Deprecation.behavior = [:stderr, :log]
ActiveSupport::Deprecation.behavior = :stderr
because they happen before Rails boots up.
Deprecation warnings raised by gems are not affected by this setting
Setting behaviors only affects deprecations that happen after boot time.
[+silence+] Do nothing.
[+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+.
[+log+] Log all deprecation warnings to +Rails.logger+.
[+stderr+] Log all deprecation warnings to +$stderr+.
[+raise+] Raise ActiveSupport::DeprecationException.
Available behaviors:
or an object that responds to +call+.
Sets the behavior to the specified value. Can be a single value, array,
def behavior=(behavior) @behavior = Array(behavior).map { |b| DEFAULT_BEHAVIORS[b] || b } end