ruby-on-railsactive-model-serializers

Remove log message in active-model-serializers


How can I remove this active-model-serializers message from my logs?

[active_model_serializers] Rendered ActiveModel::Serializer::CollectionSerializer with ActiveModelSerializers::Adapter::JsonApi


Solution

  • I haven't found anything in AMS configuration to disable logs, however, there are several other ways of achieving this by redefining ActiveModelSerializers.logger (source)

    in your config/initializers/active_model_serializer.rb:

    1) Increase the log level so that nothing will get logged:

    ActiveModelSerializers.logger.level = Logger::Severity::UNKNOWN
    

    or

    2) Write AMS log to /dev/null

    ActiveModelSerializers.logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new('/dev/null'))