Reputation: 131
I have a critical application (written in C) that is very performance sensitive. Writing things to log file will actually slow things down. I am considering to write the log messages to a socket, which gets send over to another application for logging. Would that work?
Upvotes: 2
Views: 112
Reputation: 101150
Easiest way is to create a separate thread which takes care of the log writing. Just add all log entries to a linked list and let the thread work against that list.
Upvotes: 2
Reputation: 146910
Use asynchronous I/O. This will prevent your application from blocking.
Upvotes: 1