Where is stdout for a Mac App?
It used to be that stdout went to the console log, displayed by Console.app. I've been having some problems with a firefox plugin (see other questions开发者_开发知识库, sorry about the spam...) and I was trying to use printfs to at least see if I was STARTING my plugin.
I just noticed today that my console log hasn't been updated since January 6. (Yes, I've been using the machine for the past month.) Now, I'm not the only program that uses the console log, so all those messages must be going SOMEWHERE else.
Does anyone know where?
The problem was that syslogd was broken. It's fixed now.
Solution: the problem wasn't that stdout wasn't going to the console. The problem was that the console wasn't getting written to because syslogd was buggered. Syslogd was being sandboxed for some reason, and so NOTHING had been written to the console since January 6.
the solution was to re-comment out the "uncomment this if you want to sandbox syslogd" section of LaunchDaemons/com.apple.syslogd.plist.
The solution came from superuser.com.... thanks!
printf should be going to the Console.app. It sounds like yours is broken.
A good way to debug your plugin would be to set FireFox as your XCode project's Custom Executable, and run in the debugger. Then the XCode Console would catch the output. In that case you also just use a breakpoint to see if your plugin was loading instead of printf.
After starting an app and running "lsof | grep <program_name>" it shows file descriptors 0, 1 and 2 are all /dev/null
精彩评论