CodeIgniter Forums
Logging within CI 4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Logging within CI 4 (/showthread.php?tid=77088)



Logging within CI 4 - kristianlake - 07-18-2020

Hi all,

I am looking to begin logging the data inside my CI 4 application.

I am expecting the number of users to my site to be significant enough to worry about the best way to log and store this data.

I have googled about to see if i could find some best practises and get some tips on where to begin with this but couldnt find anything obvious.

What would be the best practises for logging?

Would i let CI Logging handle its own logging of errors to a log file?

How would i handle logging for things such as failed login attempts? Would that be logged to a database instead? (say if I wanted to introduce a policy to lock accounts out if so many failures were detected)

How would you handle reporting of these? would you send an email every day/week with the logs? would you build a CRUD admin section inside your app to view the logs?

Any good links to resources , best practices , patterns and methodologies would be greatly appreciated too! Smile


RE: Logging within CI 4 - jreklund - 07-18-2020

Depends on what you want to do with the data.

Just read it yourself (application errors):
Log to file

Look something specific up (user changed password):
Log to database

Look up temporary data (X post in Y minutes etc - anti spam):
Log to database (memory table)


RE: Logging within CI 4 - kristianlake - 07-18-2020

Thanks for your reply Smile. I will probably be doing all three.