title: Rails: Normal log doesn't print out after inserting custom middleware
body: <p>I want to print out all request from client. So I write a custom middleware:</p>
  
  <pre><code>class Logger
    def initialize(app)
      @app = app
    end
  
    def call(env)
  
      headers = env.select {|k,v| k.start_with? 'HTTP_'}
      .map {|pair| [pair[0].sub(/^HTTP_/, ''), pair[1]].join(": ")}
      .sort
  
      request_params = env['rack.input'].read
  
      puts "Request: #{env["REQUEST_METHOD"]} #{env["PATH_INFO"]} #{headers} #{request_params}"
  
      @app.call(env).tap do |response|
        status, headers, body = *response
  
        puts "Response: #{status}"
        puts "Headers: #{headers}"
        # puts "Response:"
  
        # body.each do |line|
        #   puts line
        # end
      end
    end
  end
  </code></pre>
  
  <p>After that, I insert to <code>application.rb</code></p>
  
  <pre><code>config.middleware.insert_before Rails::Rack::Logger, ::Logger
  </code></pre>
  
  <p>Request is printed out fine. The only problem is all other logs (such as activerecord log hasn't existed anymore). Please help me figure out why.</p>