Ruby on Rails日志行以“I”或“W”开头

时间:2017-04-05 13:44:51

标签: ruby-on-rails ruby

注意到Rails日志中的所有行(例如production.log)都以大写“I”或大写“W”开头。例如

I, [2017-04-04T15:40:40.409423 #15879]  INFO -- : [8dd4dd50-2dba-466e-91c3-13e83333db78] Completed 302 Found in 96ms (ActiveRecord: 6.2ms)
I, [2017-04-04T15:40:40.448567 #15866]  INFO -- : [e80b7bcc-92be-465a-a9b1-1f39222238cf] Started GET "/bla" for ip at 2017-04-05 15:40:40 +0200
I, [2017-04-04T15:40:40.454994 #15866]  INFO -- : [e80b7bcc-92be-465a-a9b1-1f39123138cf] Processing by blaController#index as HTML

没有找到解释为什么它是这样的,目的是什么。

1 个答案:

答案 0 :(得分:2)

标准为here LoggerFormat为第一个值:

Log format:

SeverityID, [DateTime #pid] SeverityLabel -- ProgName: message

Log sample:

I, [1999-03-03T02:34:24.895701 #19074]  INFO -- Main: info.