简体   繁体   中英

log messages format starting with date/time

All log statements that I have seen start with date/time and then go on to provide additional information. I have always followed it as a rule of thumb, but could not give any reason when asked for.

Is there any specific reason why they always do so -OR- is it OK to format the statement such that the date/time is not the first field?

This is just a convention and it is very helpful when trying to correlate reported events or issues to messages in your log file. Most logging libraries let you configure your log message format.

It is worth keeping in mind that if anything is consuming your log files it will probably expect to find a date / time field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM