If you change the ostream associated with an ELoutput destination, you need to be careful to avoid this ways of shooting yourself in the foot:
ELadministrator logger = ELadministrator::instance(); std::ostream os1("thisFile"); ELoutput output (os1); logfile = logger->attach(output); logfile.changeFile("thisFile");What you have done is to create two std::ostreams refering to the same actual file, exactly as if you had done
std::ostream os1("thisFile"); std::ostream os2("thisFile");os1 has not been deleted and remains completely accessible. If you stream data to os1 and also send messages to logfile there will be a clash, and unpredictable behavior. If you use the same signature for changing the ostream as was used for constructing the ELoutput (either both by suppling a std::ostream or both by supplying a string to use as a file name) then you cannot get into trouble. In particular, changing from one file to the identical file will work fine: The file will be closed, then re-opened for appending.