Capturing NSLog in Leopard

  • Seems the old trick

    freopen([logPath fileSystemRepresentation],"a",stderr);

    to catch NSLog output no longer works under Leopard. It catches
    anything written to stderr, but no NSLog output. Any ideas?

    Thanks

    Gerd
  • On Nov 24, 2007, at 2:41 PM, Gerd Knops wrote:

    > Seems the old trick
    >
    > freopen([logPath fileSystemRepresentation],"a",stderr);
    >
    > to catch NSLog output no longer works under Leopard. It catches
    > anything written to stderr, but no NSLog output. Any ideas?
    >
    The point at which the above is executed is crucial. main() is to
    early, so is +load. Seems to work if done in [NSApplication init].

    Gerd
  • On Nov 24, 2007, at 4:39 PM, Gerd Knops wrote:

    >
    > On Nov 24, 2007, at 2:41 PM, Gerd Knops wrote:
    >
    >> Seems the old trick
    >>
    >> freopen([logPath fileSystemRepresentation],"a",stderr);
    >>
    >> to catch NSLog output no longer works under Leopard. It catches
    >> anything written to stderr, but no NSLog output. Any ideas?
    >>
    > The point at which the above is executed is crucial. main() is to
    > early, so is +load. Seems to work if done in [NSApplication init].
    >
    Sorry, misdiagnosed that one. It is rather more obscure:

    If logPath is on a local disk, NSLog and output directed to stderr
    appear in logPath.

    However if logPath is inside an NFS-mounted home directory, only stder
    output appears, but NSLog output goes missing. When exactly the
    freopen happens doesn't matter.

    Gerd
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today