Add more descriptive Exception Stack Trace and include option to log database queries.

Exception Stack Traces will now be printed out without cutting off valuable pieces of information.
The Stack Trace will also include the variables that where passed.

There is an option to turn on database query logging. Its been set to default as it will cause errors if the database isn't setup yet.

This was tested in L4.1 without an email server, but I'm sure the emails will work.