Log Analysis-PHP program, if you do program logs?

Source: Internet
Author: User
How do you handle system logs when using php to develop websites? I am using nginx server now. This can be used to prepare logs. In addition, log-related architecture is not used in the program. Like java, open-source tools similar to log4j are available. Does php need this? How do you handle system logs when using php to develop websites? I am using nginx server now. This can be used to prepare logs. In addition, log-related architecture is not used in the program. Like java, open-source tools similar to log4j are available. Does php need this?

Reply content:

How do you handle system logs when using php to develop websites? I am using nginx server now. This can be used to prepare logs. In addition, log-related architecture is not used in the program. Like java, open-source tools similar to log4j are available. Does php need this?

Nginx is the log of the application server. Generally, access logs are used most frequently to analyze the request URI, request consumption time, client information, and so on.

If a record is required in the business logic, it must be implemented in php. Php is relatively free. Generally, you can directly write string content to text log files. A better encapsulation can include these features: log classification, by date file, write buffer, complex structure escape, and so on.

You can refer to ZF Log implementation, you can also look at this project: https://github.com/katzgrau/KLogger

Simple business needs can be achieved by themselves, and some specifications can be referred to such as psr-3.

I also use php to monitor the log analysis Site status on the iis server. php reads and analyzes the logs two minutes ago and obtains useful information, such as 500 Error 404 error and access density... You can use it on your own, so it's a good time to troubleshoot the problem and track the trend.

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.