Webnet Webnet - 2 months ago 14
iOS Question

How to view DDLogVerbose() in console

I'm ensuring an API works correctly with a mobile app I have running in xcode. There are

calls throughout the application that I'm not able to see the output of in the console. Is there something I need to do before I can view that?

I did not configure xcode, I just cloned a git repo and hit the "Play" icon in the top left corner to build and run the project.

Right now I'm seeing a very generic error, and viewing these detailed logs would make it MUCH easier for me to debug this iteration that's failing...


DDLogVerbose is part of CocoaLumberjack. The instructions there for installation don't indicate anything about how to build/run the application.


You need to set the log level.

According to the README, you need something like this:

#import "Sprocket.h"
#import "DDLog.h"

static const int ddLogLevel = LOG_LEVEL_VERBOSE;

@implementation Sprocket

- (void)someMethod
    DDLogVerbose(@"Meet George Jetson");

This SO Answer provides a method of setting this level globally, throughout your app.

Additionally, if you use a [DDLog addLogger:someLogger withLevel:DDLogLevelVerbose]; without setting the global ddLogLevel, you won't get you logs outputted. So your best bet is to always set ddLogLevel to LOG_LEVEL_VERBOSE (or DDLogLevelVerbose in the newer versions of CocoaLumberjack) and then reducing the log level on the individual loggers.