/usr/bin/log sometimes does not work through NSTask

Our application (which happens to run in an admin account, thus there's no problem authenticating) collects logs calling /usr/bin/log through NSTask.

Usually this works all right, but sometimes all we get is the header

Timestamp Thread Type Activity PID TTL

and nothing else. The tool finishes with a zero result code, we get nothing on stderr and just the header above on stdout, with a proper EOF (as determined by a zero-length availableData read from an NSFileHandle through the stdout pipe).

At the same moment, if the /usr/bin/log tool is run manually in a Terminal window with precisely the same arguments in the same user account the application runs in, we get the logs all right.

Any idea what might be the culprit and how to fix the problem? Thanks!

/usr/bin/log sometimes does not work through NSTask
 
 
Q