3

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.

  1. location of the log file and being compatible with various O.S
  2. General format that can provide as much information as possible i.e SQL error
  3. 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/?

1

1 Answer 1

6

log4php is a library that meets all these objectives. It can write logs to:

  1. File OR
  2. Syslog (Unix) OR
  3. System Events (Windows)

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.