Modified logger. Added check in DB