Why not have a shared variable which you write the 'log' to, say an array which holds the information for each line entry, and a thread which keep an eye on the size of the shared array and dumps it out when it hits whatever size you want and resets it. This way you don't need to worry about shared filehandles, only a shared in-memory variable ( IPC::Sharable seems to be the usual way of doing this ), and you have separated the 'logging' function from the 'collection' function.
Just a something something...
|