Keeping a log file open vs. opening it every time
I wrote up a class to output logging information about my program. For instance, I initialize OpenGL and then write to the log. The old log example I have seen opens the file every single time it wants to output an error or success. Since I am writing an intensive graphics program, what would be the drawback of having the file open the 开发者_StackOverflow中文版entire time, writing to it and closing it when the program ends?
Is there a tradeoff?
Thanks!
Why be concerned with writing to a logfile yourself? Just use a standard logging framework like the log4x series
精彩评论