Changes last catch block in test_connection to catch any exception and log it.