Reworked logging again.
Added errormessages to some queries instead of throwing exceptions.