logs connection open and close stats in the db