I have a application which has two sub modules. Also their is custom Log class written to log module activities.Requirement I am working on is each module should create log file with same name and write log into that. To explain it better consider initial run in which module1 is wrting logs in app.log now when another session of application starts with module2 it should also create app.log and start writing. but before that old app.log should get rename to something app.log.1.
Issue I am facing when log file is open with one module function fails to rename. I am working in C++ on window 7. To create a file I am using - std::ofstream s_ofs.open("app.log", std::ios::out | std::ios::app);