How does PHP output debug information to log?

Source: Internet
Author: User
Tags php error php error log
How does PHP output debug information to log, what's the best way to do it?

Reply content:

How does PHP output debug information to log, what's the best way to do it?

All you need is

error_log('你要输出的信息', 3, 'log文件路径');

Can

Https://github.com/Seldaek/monolog

firephp

Error_log ($msg);
Trigger_error ($msg);
These two are the simplest, just go to the PHP error log to find the line

File_put_contents of complex points ($file _name, $msg, file_append);

Write error log, or exit breakpoint is incorrectly sent

The general framework has this method, if it is developed by itself to encapsulate a function is good. Read and write files. If only in the development phase, there is no need to output to log, directly var_dump to the page is good AH.

  • 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.