Add database logging