1

I am new to cocoa development. The question is if I want to keep an application log file, even when it is in production. Do I use NSLog or do I have to create my own file and write logs in it ?

The purpose is to be able to identify problems when it is in production from the log file. But NSLog seem to put the log in the console screen when debugging, what happens to NSLog when it is released ? can NSLog entries be retrieved ?

Ahmed
  • 14,503
  • 22
  • 92
  • 150
  • Check [here](http://stackoverflow.com/questions/7271528/nslog-into-file), especially [this answer](http://stackoverflow.com/a/8379047/653513). Some useful info also [here](http://stackoverflow.com/questions/9619708/nslog-to-both-console-and-file). And as Rengers said: try to avoid using NSLog in production version. You might want to consider using Testflight for performance or usage analysis. – Rok Jarc Jul 19 '13 at 15:46

1 Answers1

3

NSLog entries will end up in the system log files. You can view these in Console.app in /Applications/Utilities.

NSLog will slow down your app so use it only when needed.

Rengers
  • 14,911
  • 1
  • 36
  • 54
  • In addition, excessive NSLogs will drown out more useful log messages (“useful” being in the eye of the beholder, which is to say that the user might not find your console spew as useful as you do) and waste storage space. – Peter Hosey Jul 19 '13 at 23:28