Logging site logs with SQL Server _php tutorial

Source: Internet
Author: User
Tags dsn
Originally, the use of the format can be
The problem is, sometimes you might want to log logs to another server, so that if there's a problem, the log won't lose
Again, there is a benefit to logging with SQL, which is to facilitate access and query in the code, as well as statistical work
This statistic is more accurate.
Also, logging the site logs with SQL is not complex in itself
1, build a database in the target server's SQL, for example, Yaoanlog
2, in the database running IIS comes with the log table generation script, this script is in the IIS server folder: C:windowssystem32inetsrv, named Logtemp.sql, run it, will generate a data table called Inetlog
3, on the IIS server, open the ODBC Administrator, establish a system named Yaoanlog, drive Select SQL Server, the server DSN,DSN the IP address of the SQL Server server, verify, SQL Server authentication, enter the user name and password, Database Select just built Yaoanlog database, finally, test, pass the OK
4, open IIS Manager, select the site to log, in the log format, choose ODBC mode
Next, point properties
In the attribute, DSN name, enter Yaoanlog
Table name, input Inetlog
User name, enter your SQL Server user name, password, enter the password
Finally, press OK, you will be asked to enter the password again
When the confirmation is complete, stop the site and restart the site
If the settings are not problematic after you connect to the target SQL Server server, with Query Analyzer, you should be able to see the log records of the access
Also, in the help of IIS, I mentioned the phrase: "If you use ODBC logs, IIS deactivates the core cache and performance is affected"
So, if not necessary, try not to use yo


http://www.bkjia.com/PHPjc/631018.html www.bkjia.com true http://www.bkjia.com/PHPjc/631018.html techarticle Originally, with the format of the world, the problem is, sometimes, you may want to log to another server, so that, even if there is a problem, the log will not be lost again, with SQL logging and a ...

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