Log to file via PHP or log to MySQL database - which is quicker?

前端 未结 15 1295
故里飘歌
故里飘歌 2021-02-03 11:07

I have a database driven website serving about 50,000 pages.

I want to track each webpage/record hit. I will do this by creating logs, and then batch processing the logs

15条回答
  •  情深已故
    2021-02-03 11:16

    You could try both ways using log4php, which supports:

    • Configuration through xml and properties file (same structure as log4j).
    • File, RollingFile, DailyFile, Echo, Console, Mail, PEAR::Db, PHP error, Syslog or NT events and Socket appenders.
    • Simple, TTCC, Pattern, Html and Xml Layouts.
    • Nested (NDC) and Mapped (MDC) Diagnostic Contexts.
    • Switchable internal debug.

    Regarding logging into a file, you could improve performance by buffering the write requests.

提交回复
热议问题