I've created an application that makes several calls to a mysql database and executes queries. What I want to do is create/use a class that would allow me to log information related to what the user does. I would prefer that it includes the date, time, and the ability to write a specific message to the file.
What should I use that has this sort of functionality?
I heard KLogger
(found here: http://codefury.net/projects/klogger/) was a good class to use for this, but what about the PHP: syslog? (found here: http://php.net/manual/en/function.syslog.php)
Or would it be more suitable to write my own logging class? (may do that just to get some good experience) Or maybe there are other ones that I've missed and haven't mentioned that would be more suitable?
An example of what I need would be.. The user adds an entry to the database. I want to write to a file called log.txt in some specified directory that would say:
"2012/23/11 9:31AM User added entry to this table"
Any insight is greatly appreciated as always. Thank you in advance!
Do not wirte your own class for logging. This has been done a thousand times and logging frameworks like log4php are really flexible, easy-to-use and mature.
By the way, you might consider the OWASP logging cheat sheet for both complete and still legal logging.