How do I redirect all errors, including uncaught exceptions, NSLog calls, and other logs, to a log file on Mac OS X?

后端 未结 3 1553
忘掉有多难
忘掉有多难 2020-12-15 21:48

I am attempting to find a logging framework for a Cocoa application, written in ObjC.

What I\'ve attempted so far:

  1. Use NSLog, but then realise that it
3条回答
  •  悲&欢浪女
    2020-12-15 22:19

    You can intercept NSLog() messages (but not ASL in general) using _NSSetLogCStringFunction(). It’s documented here for WebObjects 4 for Windows, but it exists in current Mac OS and iOS releases too. However, it’s a private function that may go away at any time, so you shouldn’t rely on it in released code.

    If you want to be able to safely do this for non-debug builds, I suggest duplicating this enhancement request on Radar.

提交回复
热议问题