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.