11

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.

Brian Postow
  • 11,709
  • 17
  • 81
  • 125
  • 1
    This might belong on superuser.com, not sure... But I too have noticed the same issue... – Josh Feb 03 '10 at 23:26
  • well, it's programming to me because I'm using printf to get there... but yeah, superuser may know more... When did yours start? – Brian Postow Feb 03 '10 at 23:59

3 Answers3

5

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!

Brian Postow
  • 11,709
  • 17
  • 81
  • 125
3

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.

Ken Aspeslagh
  • 11,484
  • 2
  • 36
  • 42
  • Maybe I was doing something wrong before but in the past, when I've tried that, xcode got confused because firefox isn't compiled with symbols... – Brian Postow Feb 04 '10 at 14:55
  • You won't get symbols from Firefox, but you'll be able to set breakpoints in your plug-in code. – Ken Aspeslagh Feb 04 '10 at 20:56
  • When I try this, firefox crashes, asks if you want to re-start, and then crashes again, lather rinse repeat. – Brian Postow Feb 04 '10 at 23:09
  • 1
    Just a note (for those joining us in 2016): logging to stdout in an application no longer appears in Console.app as of Mountain Lion and above. For more information, see this related question: [how to get stdout into Console.app](http://stackoverflow.com/q/13104588/2415822). – JAL Nov 19 '16 at 22:16
3

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

pidloop
  • 103
  • 8