Join GitHub today
Improve logging performance #466
With debug logging enabled (that requires debug build of NZBGet) program performance is seriously affected. The slow down is caused by inefficiencies in logger. Currently to add a message into log-file NZBGet:
Opening and closing for each message has an advantage that if the program crashes all messages are guaranteed to be written into output file.
However with debug logging a lot of messages are written and these frequent opening and closing of log-file degrade performance.
In order to improve logging performance the log-file remains open for extended period of time. To avoid loosing of messages on program crash the output buffers are flushed after each message.
Although we flush as often as before the avoiding of open/close significantly improves logging speed.