LLLLLLL Posted September 23, 2010 Share Posted September 23, 2010 On MySQL 5.1.47, PHP 5.2.14. Is there a way to somehow send all mysql errors or queries to a log? I'd like to do this in a global manner, not query-by-query. I just changed some major functionality, and there are no PHP errors in the error log, but data is missing from the DB so I'm sure there's a mysql error somewhere. So a global setting is clearly ideal here! Quote Link to comment https://forums.phpfreaks.com/topic/214151-global-setting-to-log-all-mysql-errors-andor-queries/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 23, 2010 Share Posted September 23, 2010 Your application code (php) should have error checking and error reporting logic in it. That logic would then be logging problems or making use of php's built in error logging through a function like trigger_error Quote Link to comment https://forums.phpfreaks.com/topic/214151-global-setting-to-log-all-mysql-errors-andor-queries/#findComment-1114328 Share on other sites More sharing options...
LLLLLLL Posted September 23, 2010 Author Share Posted September 23, 2010 Well, you're assuming the code I have is good! It was inherited, so mysql_query($sql) is all over the place without proper handling of stuff. I'll hack away at doing it right with a single DB accessor class... Quote Link to comment https://forums.phpfreaks.com/topic/214151-global-setting-to-log-all-mysql-errors-andor-queries/#findComment-1114482 Share on other sites More sharing options...
PFMaBiSmAd Posted September 23, 2010 Share Posted September 23, 2010 The mysql query log (assuming it is on) shows the actual queries. It does not show the result. The mysql error log only shows server errors, not query errors (as far as I can tell when I tested with queries that produced things like duplicate keys, queries without data for fields that don't have defaults values...) Query errors are application level information and it is the responsibility of the application to handle them. Quote Link to comment https://forums.phpfreaks.com/topic/214151-global-setting-to-log-all-mysql-errors-andor-queries/#findComment-1114519 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.