Feature Highlight: Remote Logging with AppSpector

Feature Highlight: Remote Logging with AppSpector

Why logging?

Logging is an essential tool in software development that helps improve application quality, stability, and security. It helps developers identify and resolve issues more quickly and efficiently.

Logging provides a historical record of events and is helpful for debugging, auditing, and tracking. Debuggers, profilers, and other introspection tools provide more direct and real-time insight into the program's behavior and performance. Still, logging is essential for any software project, from a small app to an advanced enterprise system.

Besides the mentioned benefits, logs have some other that make them invaluable: once gathered, logs stay forever and can be analyzed later. Developers can compare them with other data, like user complaints, different system incident timelines, etc. The advantage of this is the ability to access logs remotely. Unlike most other development tools, logs are just plain text so you can access them via network, shared between multiple clients, filtered etc.

These peculiarities laid the foundation for the log monitor in AppSpector and the SDK-integrated logging tools we provide.

Remote Logging with AppSpector

How are people logging now?

Before talking about AppSpector logging mechanisms, let's recap how logging is performed in modern mobile development. Primarily, logs are spread across the codebase, displaying information about the application’s state and the parts of the code that are executed. While being handy for debugging, this approach introduces several issues:

  • Log gathering is not centralized. You can see them flowing into the console (or IDE output), but you can't easily store them for further examination.
  • App output becomes overwhelmed with logs of different variable values, states, logic branches etc. When looking for something specific, it quickly becomes a pain. While using IDE or console, you can use integrated search tools, but filtering them by context is impossible.
  • It's almost impossible to note something crucial in logs if you are not expecting to see it. Getting hundreds of logs a second is common for a modern mobile app. Finding several lines indicating something went wrong with your API or database is a challenging task.

Keeping this in mind, developers built lots of tools helping to maintain a considerable amount of logs and address the abovementioned issues. Log tagging and persistence are the two most helpful practices used across such libraries.

Log levels and tags

Most tools define tags and severity levels for log entries used to categorize log entries. For example, you might define tags as NETWORK, STORAGE, UI, and ANIMATION and severity levels as HIGH, MEDIUM, and LOW.

In the code, assign tags and severity levels to log entries using the APIs provided by the logging framework. For example, if your app ran out of disk space, you might use the tag STORAGE and the severity level HIGH.

You can also configure the logging framework to control the behavior of the logging system. For example, you might set the logging level to maintain the minimum severity level of entries or to configure the output location,

After that, you use the tags and severity levels to analyze the logs and identify issues and problems in the application. For example, you might filter the logs to display only log entries with a specific tag or severity level.


Most frameworks allow you to configure output options for logs. You can dump them to a file or network storage while still showing in the app output. Some tools provide network-accessed services where you can keep logs from your app and examine them later. The persistence period and disk space for logs varies depending on the pricing.

Logging with AppSpector

Of course, when we were thinking of logs management at AppSpector, we considered all mentioned above. At the time AppSpector has a set of tools to manage logs in your app.

Log Monitor

The first and most core tool of the AppSpector toolkit is the log monitor. This tool and other monitors are available for all pricing plans.

The log monitor is a simple yet powerful tool. It's a mechanism that gathers all output of your app and sends it to the AppSpector backend. Here, you can view it in real-time on a web dashboard. It also searches logs, persists them for further use, and provides filtering options.

Using the log monitor doesn't require any code from you, simply add and configure the AppSpector SDK and run your app. All logs appear on the dashboard automagically.

As mentioned above, log levels and tags are essential for any logging framework. Many developers are already using them. Moving to AppSpector doesn't mean you must reconfigure your codebase and drop old tools.

That's why we recently started to add 3rd party integrations to log monitor. We are adding support for popular frameworks allowing you to use them along with AppSpector. For example, if you use a service like Cocoa Lumberjack with levels assigned to entries, they’ll appear alongside all other outputs. You can search and filter log levels directly on the dashboard.

So, there is no need to drop the tools you use now. The transition to AppSpector logging is seamless. And we are adding more integrations all the time.

SDK Logger

AppSpector’s logger is included with our SDK. It provides the same basic functionality as any other logging framework. You can have tags and log levels, see logs on the dashboard and filter them. Logger is pretty straightforward to use:

ASAppSpectorLogger.logMessage("Service loaded", tag: "networking", level: .info)

We continue to add features to it and plan to build a full-featured logging solution around the log monitor. You can control the logs you see on the console, dumping them locally or remotely via your network to any destination.

Logging Sanitizer

Another part of the SDK logger is logging sanitizer. At AppSpector, we care about the security and privacy of our users. There are several security risks of having sensitive data in logs during the development process, including:

  • Data breaches -  Logs may contain sensitive information that can be compromised in a data breach.
  • Insider threats - Developers and other individuals accessing the logs can misuse or steal sensitive information.
  • Unauthorized access - Improperly secured Logs may be accessible to unauthorized parties through hacking or misconfigured systems.
  • Compliance violations - The presence of sensitive data in logs may violate privacy regulations, such as GDPR, and result in significant fines.

Therefore, it is essential to implement proper security and privacy controls to protect sensitive data. That’s why AppSpector offers a sanitizer (an SDK API that filters the logs that go to our backend and adjusts them if needed). In other words, you can log your REST API response during debugging and configure our sanitizer to drop any sensitive information.

Configuring a log sanitizer is simple:

let config = AppSpectorConfig(apiKey: "API_KEY")

config.logSanitizer.filter = { event in
    if event.message.range(of: "token") != .none {
        event.level = .warn
    return event

What you need to do is to assign a closure to `filter` property of the sanitizer and then perform your sanitizing logic there. All events going through log monitor will be sent to this sanitizer first.

You can find more info on using log sanitizer in the AppSpector Help Center

Custom events

Of course, the information needed for debugging is not only your app logs. Sometimes you need a deeper picture of what is happening. Using logs to inspect the data structures while your app runs can be challenging. And at best, you'll only get text data that is hard to examine quickly.

AppSpector provides a special events monitor for such purposes. Its API allows you to define a data structure for an event and then, at a specific moment, send it to the backend. After that is processed, it will be available on the dashboard with data assigned to it. Events are presented as a list, fully searchable, persistent, and available after an app session ends for later use.

Using events is as simple as defining a custom class for your event:

class ASTestCustomEventPayload: NSObject, ASCustomEventPayload {
    var name: String!
    var category: String!
    var payload: [AnyHashable : Any]!

And after that, send it by calling AppSpector SDK API:

let payload = ASTestCustomEventPayload()
payload.name = "My sample event"
payload.category = "Testing events"
payload.payload = ["Triggered at": "\(Date())"]

AppSpector.sendCustomEvent(with: payload)

Sending an event while your app is offline stores the event in an internal SDK queue. It then sends all collected events later when your connection is restored.

More info on our events monitor is available in the AppSpector Help Center


Logs play a critical role in software development by providing valuable insights and data for debugging, performance optimization, and monitoring. However, it is essential to handle logs properly to avoid security and privacy risks (i.e., data breaches, unauthorized access, and compliance violations).

By implementing appropriate security and privacy measures, you can securely leverage the benefits of log data while protecting sensitive information. Proper log management is critical to a secure and effective software development process.

At AppSpector, we continue developing our logging features, so stay tuned!

About Us

AppSpector is remote debugging and introspection tool for iOS and Android applications. With AppSpector you can debug your app running in the same room or on another continent. You can measure app performance, view CoreData and SQLite content, logs, network requests and many more in realtime. Just like you we have been struggling for years trying to find stupid mistakes and dreaming of a better native tools, finally we decided to build them. This is the instrument that you’ve been looking for.