Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does Heroku log using the server time rather than the Rails time zone?
    text
    copied!<p>UPDATE: Ok, I didn't formulate a good Q to be answered. I still struggle with heroku being on -07:00 UTC and I at +02:00 UTC.</p> <p><strong>Q: How do I get the log written in the correct Time.zone ?</strong> The 9 hours difference, heroku (us west) - norway, is distracting to work with. I get this in my production.log (using <code>heroku logs</code>):</p> <blockquote> <p>Processing ProductionController#create to xml (for 81.26.51.35 at <strong>2010-04-28 23:00:12</strong>) [POST]</p> </blockquote> <p>How do I get it to write <code>2010-04-29 08:00:12 +02:00 GMT</code> ?</p> <p>Note that I'm running at heroku and cannot set the server time myself, as one could do at your amazon EC2 servers. Below is my previous question, I'll leave it be as it holds some interesting information about time and zones.</p> <hr> <p>Why does <code>Time.now</code> yield the server local time when I have set the another time zone in my <code>environment.rb</code></p> <pre><code>config.time_zone = 'Copenhagen' </code></pre> <p>I've put this in a view</p> <pre><code>&lt;p&gt; Time.zone &lt;%= Time.zone %&gt; &lt;/p&gt; &lt;p&gt; Time.now &lt;%= Time.now %&gt; &lt;/p&gt; &lt;p&gt; Time.now.utc &lt;%= Time.now.utc %&gt; &lt;/p&gt; &lt;p&gt; Time.zone.now &lt;%= Time.zone.now %&gt; &lt;/p&gt; &lt;p&gt; Time.zone.today &lt;%= Time.zone.today %&gt; &lt;/p&gt; </code></pre> <p>rendering this result on my app at <strong>heroku</strong> </p> <blockquote> <p>Time.zone (GMT+01:00) Copenhagen</p> <p>Time.now Mon Apr 26 08:28:21 -0700 2010</p> <p>Time.now.utc Mon Apr 26 15:28:21 UTC 2010</p> <p>Time.zone.now 2010-04-26 17:28:21 +0200</p> <p>Time.zone.today 2010-04-26</p> </blockquote> <p><code>Time.zone.now</code> yields the correct result. Do I have to switch from <code>Time.now</code> to <code>Time.zone.now</code>, everywhere? Seems cumbersome. I truly don't care what the local time of the server is, it's giving me loads of trouble due to extensive use of <code>Time.now</code>. Am I misunderstanding anything fundamental here?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload