Use Vim to view logs to quickly locate problems

Source: Internet
Author: User
Cause

In general, if the test reports a problem during the development process, I usually do this:

1. Retry the test operation in your own development environment to see if you can reproduce the problem. No. 2

2. Change the database connection pool to the address of the test library and retry the test operation in your own development environment to see if you can reproduce the problem. No. 3

3. Go to the test environment to view the logs. Analyze the problem.

Quick positioning issues

Go to test the environment to view the logs and analyze the problem. Because I am not familiar with Linux commands. So check the log content is more tiring. My previous practice was to use a text editor to locate the problem in a Windows environment after downloading the log.

But sometimes the log is larger, with hundreds of MB or even a few gigabytes .... Download down to n long time ... Open also need to occupy a lot of memory .... People can't stand it.

One chance I found out that the architect was using Vim to view the log.

So I also installed Vim on my own machine. and tried, found that really good use ....

So I'm looking at the log now:

First

VIM journal name

Go to log ... In the future, general test report problems will have a small section of the log. To find this log, I think the most important thing is to take advantage of the log time. So just search for this log time.

/Search Keywords

For example, I know the test report of the problem time is happening today at 14 O ' Day. Then I will enter/2016-02-16 14:..:.. You can have it ....

. is the meaning of any character. Similar to regular expressions ... I will not elaborate ...

You can search after you press ENTER. Press N to find the next one. Press N to find the previous one.

Alternatively, you can enter: Set HLS to set the Found keyword highlighting. Just like in my picture ...

Search finished to return to the original input place just press ctrl+o on it.

It's really very efficient to find a location problem .... As long as the log is detailed, you will soon find the problem ...

In short, the use of vim to search than to download the log to see the real convenience is too much ....

Use Vim to view logs to quickly locate problems

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.