2015-06-11 45 views
3

我已將google-chrome配置爲dump a debug log to chrome_debug.log in the user-data-dirchrome_debug.log中日誌前綴的格式是什麼?

這對於調試我們一些更加鈍的瀏覽器問題非常方便。但是,我有一些超時問題,所以我想弄清楚日誌行上的前綴是什麼意思。由於這個日誌來自今天(6月11日),所以我猜「0611」部分是今天的日期。我猜測後面的「/ 053512」是幾秒鐘的時間戳?

[296:296:0611/053512:VERBOSE1:password_store_factory.cc(276)] Password storage detected desktop environment: (unknown) 
[296:296:0611/053512:WARNING:password_store_factory.cc(322)] Using basic (unencrypted) store for password storage. See http://code.google.com/p/chromium/wiki/LinuxPasswordStorage for more information about password storage options. 
[296:296:0611/053512:VERBOSE1:render_process_host_impl.cc(687)] Mojo Channel is enabled on host 
[6:6:0611/053512:VERBOSE1:sandbox_linux.cc(68)] Activated seccomp-bpf sandbox for process type: renderer. 
[6:6:0611/053512:VERBOSE1:child_thread_impl.cc(321)] Mojo is enabled on child 
[6:6:0611/053527:INFO:child_thread_impl.cc(725)] ChildThreadImpl::EnsureConnected() 
[296:318:0611/053611:VERBOSE1:chrome_browser_main_posix.cc(216)] Handling shutdown for signal 15. 

更好的是指向代碼生成前綴的地方。因爲我懷疑它會改變(我在Debian Linux上運行chrome v43.0.x)。

doc說:

由每行括號包圍的樣板的值是以下格式:

[PROCESS_ID:的thread_id:ticks_in_microseconds:LOG_LEVEL:FILE_NAME(LINE_NUMBER)]

但「0611/053512」很明顯不是「ticks_in_microseconds」。

回答

2

Chrome的base/logging.cc in LogMessage::Init定義了來自chrome_debug.log的日誌前綴的內容。時間戳部分被定義爲:

struct tm* tm_time = &local_time; 
stream_ << std::setfill('0') 
     << std::setw(2) << 1 + tm_time->tm_mon 
     << std::setw(2) << tm_time->tm_mday 
     << '/' 
     << std::setw(2) << tm_time->tm_hour 
     << std::setw(2) << tm_time->tm_min 
     << std::setw(2) << tm_time->tm_sec 
     << ':'; 

所以這就是:MMDD/HHMMSS(月,日,/,小時,分鐘,秒)。

因此,兩個時間戳「0611/053512」和「0611/053611」之間的差異不是99秒,而是59秒。