Fixes issue with logging for recommended rails config file format

For certain config file formats, the shard/database name wasn't getting prepended to the SQL query lines. This fixes that bug.