As a communication code farm, regular analysis of large-length log. Over time, how to quickly in the Party text log to clarify the problem occurred in the scene, the location of the problem, gradually have a little experience, this article shared out, hoping to exchange experience.
The core of my experience is the use of regular expressions:
1) Use regular expressions instead of simple keyword search
The average person will use a word in the log search directly, such as to find module A, may directly search for "Modulea", so that the results are only related to your module, but still the log volume is huge. The benefits of analyzing the problem are still limited.
What I do is, first of all, you have to understand the process of the module you are responsible for, such as the startup process has a log like this:
Modulea I ' m in status xx, send out event xxx
Module A now status xxx, notify event xxx
Then use the regular expression "modulea.*event" search. You can check if the startup process is normal, not normal, and which step the exception occurred in.
2) search multiple modules simultaneously
Then the above example, if during the startup process, suspected Moduleb behavior is an exception to hinder the execution of Modulea. The general practice is to divide two searches, one search Modulea related, one search Moduleb related. Can actually be put together to search:
If Moduleb has the following log:
Moduleb xxx run in step xxx
Moduleb xxx Run pass step XXX
We can use the regular expression "modulea.*event|moduleb.*step" to search, so that the log you are interested in will be placed in a search results. It is useful to analyze the interaction between the two modules and the time relationship.
3) If the log scene is unfamiliar to you, but it is generally confirmed that you are responsible for the module error, you do not have a fixed pattern to search. In this case I will generally try to "modulea.*err|modulea.*fail", Err/fail can be replaced by other you often encounter the expression of the exception of the keyword, more than half the probability of experience can also find the point where the problem occurred:)
4) Finally explain: my longest use of ultraedit is to support the above regular expression usage. Although notepad++ also support, but there is a bug, that is, the search results often have redundant entries, for example, log "Modulea in step xxx,notify moduleb", if I use regular search "Modulea|moduleb", The above line of log will be displayed two times in the results, and the UltraEdit is displayed only once.
Easylifesoso night OF, Jan, 8th
[Original] Programmer's parser log the most practical tricks