Improve logging on database connections