<p>I have an app using Rails 2.5.1 which is deployed on Google Cloud Kubernetes but the logs are not working good.The FATAL errors are displayed as INFO logs instead of ERROR or CRITICAL. </p>

<p><a href="https://i.stack.imgur.com/Yj8ot.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yj8ot.png" alt="enter image description here"></a></p>

<p>Extra context:</p>

<ul>
<li>Rails 5.2.1</li>
<li>This view is from <code>Logs Viewer</code></li>
<li>I'm using <code>RAILS_LOG_TO_STDOUT=true</code>. If I remove this, logs are not displayed at all</li>
</ul>

<p>Thanks.</p>

<p>[UPDATE]</p>

<p>I updated my cluster to use the newest Stackdriver API but it stills not working and <code>Rails.logger.error</code> is displayed as INFO.</p>

<p><a href="https://i.stack.imgur.com/fKoi6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fKoi6.png" alt="enter image description here"></a></p>

<p>I got this working changing the log format to use JSON.</p>

<pre><code>config.log_formatter = proc do |severity, datetime, progname, msg|
    message = msg
    message &lt;&lt; " from #{progname}" if progname.present?
    content = JSON.dump(timestamp: datetime.to_s, severity: severity, message: message)
    content &lt;&lt; "\n"
    content
  end
</code></pre>
