Run logging code outside of transaction

If the user tries to log to database inside transaction scope and rollbacks that transaction the logging will be rolled back to. With this change we never create a transaction when writing to database.