<p>We have set logger as STDOUT in the rails configuration.</p>
<pre><code>  config.log_level = :info
  config.logger = Logger.new(STDOUT)
</code></pre>
<p>We are expecting these logs in kubectl logs as well as datadog logs but STDOUT is not showing up there. We tried below code to test it.</p>
<pre><code>def method_name
  system('echo testing logging') - this shows up in kubectl/datadog logs
  Rails.logger.info('STDOUT - testing logging') - this does not show up in kubectl/datadog log
end
</code></pre>

Priya
<p>Try to use the default config and make sure to set the environment variable <code>RAILS_LOG_TO_STDOUT=true</code>, for your deployment/replica set, and in production mode (<code>RAILS_ENV=production</code>). (In dev mode it always logs to console per default).</p>
<p>Actually, the official rails docker images used to have that set, but the newer recommended ruby docker images - of course - do not have Rails specific environment variables set.</p>
<p>(more: search for <em>RAILS_LOG_TO_STDOUT</em> in the <a href="https://guides.rubyonrails.org/v5.1/5_0_release_notes.html" rel="nofollow noreferrer">release notes here</a>, and see <a href="https://github.com/rails/rails/pull/23734" rel="nofollow noreferrer">PR here</a>)</p>
