In my previous post, Capturing Erroneous Queries with MySQL Proxy, I showed how to capture erroneous queries, along with relevant information, that one could not effectively obtain from the MySQL general query log. However, in that post, I simply output the information to the terminal. Therefore, in this example, I want to show how to write this information to a proxy log file.
To change this to log to a log file does not require too many changes, and so this is a useful example on how to log any proxy-related information to a log file.
if (log_file == nil) then log_file = "C:/Program