Removed an extra copy() in the Logger and also fixed memory leaks in c++ test