Added logging to the database script