0

I would like to debug my stored procedures properly, the easiest way i can think of is to be able to send debug messages to the log file of mysql. is that possible ?!

ufk
  • 28,948
  • 61
  • 217
  • 363

2 Answers2

2

As I have not heard of anything like that I will recommend you this http://benjisimon.blogspot.com/2007/02/debugging-mysql-stored-procedures.html

or read this topic How do you debug MySQL stored procedures?

Community
  • 1
  • 1
Yasen Zhelev
  • 3,940
  • 3
  • 28
  • 54
  • welp if there isn't any way to send messages to the log file, the method of creating a log table and inserting log strings to that table is a suitable answer for me. thanks – ufk Nov 30 '10 at 18:31
2

You can install the User Defined function that is available here...

https://github.com/mysqludf/lib_mysqludf_log

and then use it anywhere in the select query like...

mysql> SELECT log_error(concat(now(), 'error in selecting line 13'));
+--------------------------------------------------------+
| log_error(concat(now(), 'error in selecting line 13')) |
+--------------------------------------------------------+
|                                                      0 |
+--------------------------------------------------------+
1 row in set (0.00 sec)

# tail /var/log/mysqld.log
2010-12-02 03:16:03error in selecting line 13
Community
  • 1
  • 1
shantanuo
  • 30,102
  • 75
  • 225
  • 364