Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is another kind of log that PHP programmers need to know?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you another kind of log that PHP programmers need to know, which is concise and easy to understand. I hope you can get something through the detailed introduction of this article.

Preface

As a programmer, the only thing that is more important than code is log analysis and query. Common logs and setting methods are listed below.

Configuration file

Nginx is divided into access_log and error_log logs.

The setting needs to be in nginx.conf. By default, the nginx directory for compiling and installing through the source package should be in the

/ usr/local/nginx

Directory, if you install through yum or other means, do not know or do not know the specific installation directory of nginx, you can use the

Find /-name nginx.conf

Or

Nginx-V | grep prefix-nginx version: nginx/1.13.9built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017TLS SNI support enabledconfigure arguments:-- prefix=/usr/local/nginx-- with-http_ssl_module

Open the access log

If your source package is installed by default, the open path is as follows

Vim / usr/local/nginx/nginx.conf

Find the following

Http {include mime.types; default_type application/octet-stream; log_format main'$remote_addr-$remote_user [$time_local] "$request"'$status $body_bytes_sent "$http_referer"'"$http_user_agent"$http_x_forwarded_for"; access_log logs/access.log main;.}

Just open the comments from log_format to access_log, and log_format can define the log specifications for nginx.

Log_format default specification parameter table

Open error log

If your source package is installed by default, the open path is as follows

Vim / usr/local/nginx/nginx.conf

Find the following

Error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info

You can delete the comments, and you can store different error types separately, such as

Error_log logs/error.log notice

Notice is an error type, if you don't write it, it's all.

The above is another kind of log that PHP programmers need to know. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report