Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 297
Brian Postow Avatar asked Feb 03 '10 23:02

Brian Postow


3 Answers

After starting an app and running "lsof | grep <program_name>" it shows file descriptors 0, 1 and 2 are all /dev/null

like image 94
pidloop Avatar answered Sep 29 '22 02:09

pidloop


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!

like image 25
Brian Postow Avatar answered Sep 29 '22 01:09

Brian Postow


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.

like image 22
Ken Aspeslagh Avatar answered Sep 29 '22 03:09

Ken Aspeslagh