I am codding an algoritm that uses the database as input and output.
I need to keep a log at least of all the queries. Afected rows and errors would be cool as well.
I would like the logs to be saved in a textfile.
One solution i thoght about is creating a wraper for mysql_query() that writes the query and the error ( if exists ) to the file. then use allways that function, mysql_query_w() for instance...
I remember when i used oracle it was possible to output a report after each instruction... is it anyway i can get that report ( it's equivalente for mysql ) into php?
thx in advance
Logging database activity
Moderator: General Moderators
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Ok... this is something in wich php is not so complete already... maybe in version 5...
I thought about storing the following information for each query:
a timestamp
query string
affected rows
error message
in the database, then run a script to dump it to a text file...
but before i will have a look at mysql log files.
php is great, i love it and i am one of the big defensors of it, but i see what experienced programmers mean when they point some lack of features on php. Well... actually this might be a mysql issue.
I thought about storing the following information for each query:
a timestamp
query string
affected rows
error message
in the database, then run a script to dump it to a text file...
but before i will have a look at mysql log files.
php is great, i love it and i am one of the big defensors of it, but i see what experienced programmers mean when they point some lack of features on php. Well... actually this might be a mysql issue.
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
MySQL has several logs that it can generate if you tell it to, but it is done in the configuration file or at start up.
http://dev.mysql.com/doc/refman/4.1/en/log-files.html
http://dev.mysql.com/doc/refman/4.1/en/log-files.html