Allow the Debug system plugin to write executed query to a file

### Purpose
Speed up the process of benchmarking  SQL queries executed by a Joomla! page with tools like mysqlslap, pgbench, etc..., writing a file with the extecuted query for the page visited

### How it works
Add a parameter (disabled for default) to the logging tab: Log extecuted SQL
![pluginsystemdebug](https://cloud.githubusercontent.com/assets/181681/5461793/76e419c0-856e-11e4-9c03-eaa06a98beb2.png)

When enabled it write a file to the logs folder named: 
sitename_alias+id for frontend 
sitename_option_view_layout for administration side

@alikon Please rename the function from write2file to writeToFile thanks.