I am designing a online website (PHP, HTML and MySQL) with one of the functionalities being able to upload and download the records to/from database. I want to keep a log of all the records that were successfully added to the database and all the failed ones as well. If I wish to save this log file on the local machine, how should I go about with designing the log system ? i.e.
- location of the log file and being compatible with various O.S
- General format that can provide as much information as possible i.e SQL error
- Any other pointers I need to consider.
Can anyone please guide me to the correct setup?
I have included include '/Logger.php'; line in my php file. However, I want to write the log to a file and I don’t understand if the configuration file is log4php.xml or appender_file.properties. Can anyone please tell me the setup to log write to a file/?
log4php is a library that meets all these objectives. It can write logs to:
And is configured via XML. All standard logging functions like log file rotation (E.g. create a new log file after size is 10 MB or every day, zip previous files) and customizable layout of files.