What's more efficient - storing logs in sql database or files?

后端 未结 9 1521
暗喜
暗喜 2020-12-15 03:30

I have few scripts loaded by cron quite often. Right now I don\'t store any logs, so if any script fails to load, I won\'t know it till I see results - and even when I notic

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-15 03:51

    Writing the filesystem should always be faster.

    That however shouldent be your concern. Both doing a simple insert and writing to a file system are quick operations. What you need to be worried about is what happens when your database goes down. I personaly like to write to both so there is always a log if anything goes wrong but also you have the ease of searching from a database.

提交回复
热议问题