Home >Database >Mysql Tutorial >How to check the logs of IIS, PHP and MySQL

How to check the logs of IIS, PHP and MySQL

WBOY
WBOYforward
2023-06-02 16:57:322022browse

1. IIS log

  1. Open IIS, find the website, right-click and select "Properties" and find the "Website Home Directory" option Card.

  2. In the "Log file" column, select "Daily" or "Maximum file" as the log method.

  3. To view the log, you can view the path of the log file in "Website Properties" - "Log File".

2. PHP log

You can use the following function to open the error log in PHP:

ini_set('error_log', 'C:/path/to/php-error.log');  // 将错误日志打印到指定文件中
ini_set('log_errors', true);  // 开启错误日志
error_reporting(-1);  // 输出所有错误信息

It is recommended to Error logs are printed to separate files for easier viewing. To view the error log, you can directly open it through the file path.

3. MySQL logs

MySQL logs are divided into error logs, warning logs, slow query logs and binary logs. They can be enabled through the following command line operations:

  1. Error log:

Add the following configuration to the MySQL configuration file to enable the error log:

log_error=/path/to/mysql-error.log

Among them /path/to/mysql-error.log is the error log path.

  1. Warning log:

Add the following configuration to the MySQL configuration file to enable the warning log:

log_warnings=2

where2 is the warning level.

  1. Slow query log:

Add the following configuration to the MySQL configuration file to enable the slow query log:

slow_query_log=1
slow_query_log_file=/path/to/mysql-slow.log

Among them /path/to/mysql-slow.log is the slow query log path.

  1. Binary log:

Add the following configuration to the MySQL configuration file to enable binary log:

log-bin=/path/to/mysql-bin

where/path/to/mysql-bin is the binary log path.

The above is the detailed content of How to check the logs of IIS, PHP and MySQL. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete