iOS Logging With Lumberjack

August 15, 2012 Pivotal Labs

When debugging your mobile application, logging can provide critical information. A few problems arise from the simplicity of iOS’s logging interface. The built-in method, NSLog, is mainly a development tool, but when left in release code it will still be executed. Removing NSLog calls before release can be a tiresome process, but leaving them in will slow down your application.

A nice feature of Android logging is the multiple log levels. iOS only has one, making it impossible to choose on the fly which log statements should be shown. A selective level of output helps display what’s most important.

Lumberjack brings some of this flexibility to iOS logging. Log levels can be customized per file and easily turned off. Multiple logging events, such as saving to file and outputting to the console, can be executed simultaneously.

For simple logging, a substantial performance gain can be seen over NSLog. Lumberjack benchmarks at up to 32x faster for asynchronous logging.


It is very easy to get started using Lumberjack in your iOS project. In your AppDelegate, simply do the following:

Import DDLog.h and DDTTYLogger.h and add the following line to didFinishLaunchingWithOptions.

[DDLog addLogger:[DDTTYLogger sharedInstance]];

In any method you wish to use a log statement, you must import DDLog.h and you must have access to a log level variable:

static const int ddLogLevel = LOG_LEVEL_VERBOSE;

Finally, you can call the log function using one of the following using the same parameters as you would using NSLog(NSString *format, ...):

  • DDLogError
  • DDLogWarn
  • DDLogInfo
  • DDLogVerbose


  • log level support
  • easily switch off logging for release
  • optional logging to file
  • increased performance


  • need to import headers
  • must re-run the application to change the log level

About the Author


Data Scientists: Brainy, In Demand, and…Athletic?
Data Scientists: Brainy, In Demand, and…Athletic?

Kaggle's description of data science as sport appears to be catching on. In a recent post, VentureBeat's Ch...

He's coming to the party?!
He's coming to the party?!

Helps Jasmine Gem HEAD and undefined JSON We're trying to use the latest jasmine with ci_reporter, and jas...

SpringOne 2021

Register Now