2017-04-05 49 views
2

注意到Rails日誌中的所有行(例如production.log)都以大寫「I」或大寫「W」開頭。例如Ruby on Rails日誌行以「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 

找不到解釋爲什麼它是這樣的,目的是什麼。

+7

信息,警告,錯誤 - )),並沒有什麼可以做的nginx(也有欄杆)是Ruby的記錄儀的功能class https://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html – marmeladze

+0

哦,就是這麼簡單:)謝謝! –

回答

2

這是標準LoggerFormatSeverityID的第一個值:

Log format: 

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

Log sample: 

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