Logging Events to the SDK Server

Logging Events to the SDK Server

The Applause SDK allows you to manually log events to the Applause SDK server. This can be useful when you are debugging problems or crash reports submitted by your users because you can track custom defined activities from your application.

Note: You can safely replace all the instances of NSLog in your app with APLLog orAPLExtendedLog. If the Applause SDK is disabled, the logging methods will only log data to the console (behaving just like the built-in NSLog). However, when the Applause SDK is enabled, the logging methods will also log to the Mobile SDK server.



APLLog works just like the regular NSLog. APLLog logs the message to the console, just line NSLog. However, APLLog also sends the logged string to the Applause SDK server where it can be reviewed along with crash reports, bug reports, and other session data from the device.


void APLLog (NSString *format, ...);


// This is the standard Applause SDK logging method. It works very similarly to NSLog. 
// (You can even use this method in place of NSLog - data sent to APLLog will 
// still be logged to the console.)

APLLog(@"Example of APLLog", nil);

// An example of the standard Applause SDK logging method with parameters.

APLLog(@"APLLog with a parameter: %@", @"demo parameter");

Once the Applause SDK receives the logged message, it will automatically tag the event with “ApplauseLog.”


As of 2.1.2 not supported yet.



For more granular logging, you can use the APLExtendedLog method. This method works just like APLLog, however it also allows you to manually tag the log and add a log level. The tag and log level can help you better categorize the logged activity within the Applause SDK.


void APLExtendedLog(APLLogLevel level, NSString nsstring_tag, NSString nsstring_format, ...)

The parameters are:

  • level – an enum with one of the following log levels:
    • APLLogLevelFatal
    • APLLogLevelError
    • APLLogLevelWarning
    • APLLogLevelInfo
    • APLLogLevelVerbose
  • nsstring_tag – a string for including a tag
  • nsstring_format – a format containing the log message itself, where “…” is the argument list for the format string


// Here's an example of the extended logging method with a warning log level and no tags.
APLExtendedLog(APLLogLevelWarning, nil, @"APLExtendedLog with a warning log level", nil);

// Here's an example of the extended logging method with a verbose log level and a custom tag.
NSString *const tag = @"example_tag";
APLExtendedLog(APLLogLevelVerbose, tag, @"APLExtendedLog with a verbose log level and with tag: %@", tag);


Swift does not support macros, hence APLLog does not work. That’s why we’ve introduced the following category on APLLogger to expose logging methods in Swift:

@interface APLLogger (APLSwiftLoggingSupport)
+ (void)log:(NSString *)message; //default info log
+ (void)log:(NSString *)message withLevel:(APLLogLevel)logLevel;

So in you Swift code you can do the following:

APLLogger.log("This is a default info log with object (object)")
APLLogger.log("This is a warning log with object (object)", withLevel: APLLogLevelWarning)

Object Logging


The Applause SDK iOS Client Library also allows for object logging which allows you to log each and every message sent to any object created inside your application (with the exception of singleton objects created using Apple’s singleton pattern). To setup object logging, use the following method of the APLLogger:

[APLLogger registerObjectForLogging:self];


Defining the Object
@implementation ExampleLogObject
- (id) init {
    self = [super init];
    if(self) {       

    // This method registers this object for logging with Applause SDK. Messages sent to this object will
    // also be sent to Applause SDK for debugging purposes.
    return [APLLogger registerObjectForLogging:self];

- (void) testMethod {


  • Object logging is not available for static methods.
  • This method creates another object for each registered object. While this additional object is very lightweight (smaller than NSObject), it can still have an impact on application performance.
Calling the Object

You would use this object, just like normal.

ExampleLogObject *testObject = [[ExampleLogObject alloc] init];
[testObject testMethod];


This funcionality is not supported in Swift.