We [Professor and PhD Student in Software Engineering at a State University in India] are working towards a source code analysis tool which can assist practitioners in writing effecting log statements. There are more than 10000 log statements in CloudStack (s_logger.error, s_logger.warn, s_logger.trace, s_logger.info……………….)
The focus of this email is on format and consistency of log statements. We analyzed all the log statements and observe that the log statements prints a message and variable(s). However it does not print the log level, timestamp and thread-name. I believe you agree with me that - Information like timestamp [Date date= new Date(); new Timestamp(date.getTime())] and thread-name [Thread.currentThread().getName()] is useful for diagnosing production failure and root-cause analysis. It is also useful in studying patterns and trends. We have the following questions: 1) Why log-level, timestamp and thread-name is not logged. 2) How important (different people may have different opinion) is Point 1 (mentioning log-level, timestamp and thread-name) 3) Is there a standard guideline for developers for writing log statements – which CloudStack developers need to follow 4) Do you use any log-analysis tool? How are logs analyzed (visual inspection, home-grown tool/program, external open-source/commercial tool)? 5) CloudStack can be used in a multi-threaded environment and I am not clear why the thread name is not printed Thanks in advance and appreciate it. We want to build a tool (not just about format and consistency) that will be practically useful to practitioners and will make it open-source & publicly available. This is part of an academic/research study and hence request a response to all questions. Thanks and Regards, Ashish and Sangeeta -- Ashish Sureka : [Homepage http://www.iiitd.edu.in/~ashish/ ] , [Blog : http://ashish-sureka-delhi.blogspot.in/ ]