Store log in database.