PHP log writing implementation method, php log implementation

Source: Internet
Author: User

PHP log writing implementation method, php log implementation

This example describes how to write logs in PHP. Share it with you for your reference. The specific implementation method is as follows:

Copy codeThe Code is as follows: function logError ($ content)
{
$ Logfile = '/logs/debuglog'.date('ymd'{.'.txt ';
If (! File_exists (dirname ($ logfile )))
{
@ File_Util: mkdirr (dirname ($ logfile ));
}
Error_log (date ("[Y-m-d H: I: s]"). "-[". $ _ SERVER ['request _ URI ']. "]:". $ content. "\ n", 3, $ logfile );
}
 
Note the following:
Copy codeThe Code is as follows: chown-R www: www csevent/
If your apache configuration is not www, you need to change it to the corresponding
You can run the ll command to view your permissions.

I hope this article will help you with PHP programming.


How to Write logs in php

PHP logs are worrying...
Plug it into the database. There is no other good solution ..
If the data volume is large, you can first record the data in the file according to the format, and then load the database.

PHP job: Design and Implementation of the log system

Some of them are not correct, but the method is like this. We have written a log, and some aspects are helpful. Let's take a look.


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.