logging - How to write log file so that it can be read with notepad in real time for C++ -
i need logger c++. , found post small logger class, led me simple logger http://www.drdobbs.com/cpp/201804215.
it uses following method wirte log file.
file* pfile = fopen("application.log", "a"); std::ostringstream os; os<<"i log line."<<std::endl; fprintf(pfile, "%s", os.str().c_str()); fflush(pfile);
but doesn't work expected. assume, log file open in notepad, each new log line showing after fprintf , fflush. turned out have close , reopen file notepad see update.
so there way write log file in c++ allows reading in real time, makes log file resemble win32 console or vs output window? miss days when can dump console.log in javascript. :)
thanks.
this not problem code, issue notepad. notepad not automatically check changes in file have open.
instead, should use tool does, instance notepad++, or indeed editors designed programmers.
if have installed cygwin, use tail -f
monitor additions log file.
Comments
Post a Comment