CocoaLumberjack is a free, open source monitoring & observability project written in Objective-C and released under BSD-3-Clause. It has 13,319 GitHub stars, 2,274 forks and 7 open issues, and was last pushed 41 hours ago. On this registry it ranks #31 of 97 tracked projects in Monitoring & Observability, with 5 head-to-head comparisons available.

What is CocoaLumberjack?

CocoaLumberjack is a fast and flexible logging framework, written primarily in Objective-C with first-class Swift support, for applications targeting macOS, iOS, tvOS, watchOS and visionOS.

What it is

CocoaLumberjack is a logging framework distributed as a source library rather than a service. It ships under the BSD-3-Clause licence, lives in the Apple platform ecosystem, and can be pulled in through Swift Package Manager, CocoaPods, Carthage, or manual installation. The core is Objective-C, with an additional CocoaLumberjackSwift product for Swift consumers, and the repository carries 13,319 stars, 2,274 forks, 7 open issues, and a last push of 2026-09-16. Topics list ios, macos, objective-c, swift, spm, cocoapods, carthage, log, logger and logging.

The concrete problem it solves is scattered, single-destination logging. An app that calls the system log directly, or writes its own file output, has one hard-wired sink and no shared level model. CocoaLumberjack replaces that with a single DDLog entry point and pluggable loggers: DDOSLogger routes to os_log, DDFileLogger writes rolling files, and DDTTYLogger and DDASLLogger cover earlier OS versions. Multiple loggers are attached to the same call sites, so the same DDLogInfo or DDLogError statement reaches unified logging, a file, or both without changing app code.

Key capabilities

  • Pluggable, composable logger destinations — DDOSLogger, DDFileLogger, DDTTYLogger and DDASLLogger — registered together via DDLog.add(fileLogger) in Swift or [DDLog addLogger:fileLogger] in Objective-C.
  • Five log levels exposed as macros and functions: DDLogVerbose, DDLogDebug, DDLogInfo, DDLogWarn and DDLogError.
  • Rolling file logging through DDFileLogger, configured with rollingFrequency = 60 * 60 * 24 for a 24-hour roll and logFileManager.maximumNumberOfLogFiles = 7 for retention.
  • Dual-language usage: import CocoaLumberjackSwift or import CocoaLumberjack in Swift, @import CocoaLumberjack; or #import in Objective-C.
  • Coverage of five Apple platforms: macOS, iOS, tvOS, watchOS and visionOS.
  • Swift Package Manager support since version 3.6.0, with the CocoaLumberjack and CocoaLumberjackSwift products both added to a target.
  • Continuous integration and coverage reporting, visible through the unit test workflow badge and the Codecov badge.

Who uses it and how

  • Apple platform teams who need application logs routed into unified logging via DDOSLogger on iOS 10 and later.
  • Apps that ship on-device rolling log files for support diagnostics, using the 24-hour rollingFrequency and the seven-file maximumNumberOfLogFiles ceiling.
  • Multi-platform products spanning iOS, macOS, tvOS, watchOS and visionOS, where one logging API is shared across every target.
  • Mixed Swift and Objective-C codebases, which use the CocoaLumberjack/Swift subspec to pull in the Objective-C code plus the Swift additions.
  • Projects standardised on a specific dependency manager, whether that is Swift Package Manager, CocoaPods with an iOS 11.0 deployment target, or a Carthage Cartfile entry of github "CocoaLumberjack/CocoaLumberjack".

Getting started

Install through Swift Package Manager by adding .package(url: "https://github.com/CocoaLumberjack/CocoaLumberjack", from: "3.9.0") and both the CocoaLumberjack and CocoaLumberjackSwift products, or through CocoaPods, Carthage, or the manual installation guide in Documentation/GettingStarted.md. Then attach a logger, for example DDLog.add(DDOSLogger.sharedInstance).

How it compares

The facts provided name no comparable logging library and no list of paid products this project replaces, so it stands alone in this registry: it is the only Apple-platform logging framework described here. The dependency managers in its topics, spm, cocoapods and carthage, are distribution channels it supports rather than alternatives to it.

When to use it — and when not to

CocoaLumberjack is a library embedded in an application, not a service, so a self-hoster operates no database, object storage, or SMTP; the whole cost sits in app-side integration and in choosing logger destinations. Teams that need centralised, server-side log aggregation, or that ship outside the Apple platforms, should look elsewhere, because nothing in the provided facts describes a hosted or backend component. One honest limitation: the README excerpt shown cuts off mid-sentence inside the Objective-C usage example, and manual installation is delegated to a separate document, so the repository page alone does not cover every integration path.

project readme (upstream, from github) — read inline

CocoaLumberjack

Version License Carthage compatible Unit Tests codecov

CocoaLumberjack is a fast & simple, yet powerful & flexible logging framework for macOS, iOS, tvOS, watchOS and visionOS.

How to get started

First, install CocoaLumberjack via Swift Package Manager, CocoaPods, Carthage or manually. Then use DDOSLogger for iOS 10 and later, or DDTTYLogger and DDASLLogger for earlier versions to begin logging messages.

Swift Package Manager

As of CocoaLumberjack 3.6.0, you can use the Swift Package Manager as integration method. If you want to use the Swift Package Manager as integration method, either use Xcode to add the package dependency or add the following dependency to your Package.swift:

.package(url: "https://github.com/CocoaLumberjack/CocoaLumberjack", from: "3.9.0"),

Note that you may need to add both products, CocoaLumberjack and CocoaLumberjackSwift to your target since SPM sometimes fails to detect that CocoaLumberjackSwift depends on CocoaLumberjack.

CocoaPods

platform :ios, '11.0'

target 'SampleTarget' do
  use_frameworks!
  pod 'CocoaLumberjack/Swift'
end

Note: Swift is a subspec which will include all the Obj-C code plus the Swift one, so this is sufficient. For more details about how to use Swift with Lumberjack, see this conversation.

For Objective-C use the following:

platform :ios, '11.0'

target 'SampleTarget' do
    pod 'CocoaLumberjack'
end

Carthage

Carthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods.

To install with Carthage, follow the instruction on Carthage

Cartfile

github "CocoaLumberjack/CocoaLumberjack"

Install manually

If you want to install CocoaLumberjack manually, read the manual installation guide for more information.

Swift Usage

Usually, you can simply import CocoaLumberjackSwift. If you installed CocoaLumberjack using CocoaPods, you need to use import CocoaLumberjack instead.

DDLog.add(DDOSLogger.sharedInstance) // Uses os_log

let fileLogger: DDFileLogger = DDFileLogger() // File Logger
fileLogger.rollingFrequency = 60 * 60 * 24 // 24 hours
fileLogger.logFileManager.maximumNumberOfLogFiles = 7
DDLog.add(fileLogger)

...

DDLogVerbose("Verbose")
DDLogDebug("Debug")
DDLogInfo("Info")
DDLogWarn("Warn")
DDLogError("Error")

Obj-C usage

If you're using Lumberjack as a framework, you can @import CocoaLumberjack;. Otherwise, #import

[DDLog addLogger:[DDOSLogger sharedInstance]]; // Uses os_log

DDFileLogger *fileLogger = [[DDFileLogger alloc] init]; // File Logger
fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
fileLogger.logFileManager.maximumNumberOfLogFiles = 7;
[DDLog addLogger:fileLogger];

...

DDLogVerbose(@"Verbose");
DDLogDebug(@"Debug");
DDLogInfo(@"Info");
DDLogWarn(@"Warn");
DDLogError(@"Error");

Objective-C ARC Semantic Issue

When integrating Lumberjack into an existing Objective-C it is possible to run into Multiple methods named 'tag' found with mismatched result, parameter type or attributes build error.

Add #define DD_LEGACY_MESSAGE_TAG 0 before importing CocoaLumberjack or add #define DD_LEGACY_MESSAGE_TAG 0 or add -DDD_LEGACY_MESSAGE_TAG=0 to Other C Flags/OTHER_CFLAGS in your Xcode project.

swift-log backend

CocoaLumberjack also ships with a backend implementation for swift-log. Simply add CocoaLumberjack as dependency to your SPM target (see above) and also add the CocoaLumberjackSwiftLogBackend product as dependency to your target.

You can then use DDLogHandler as backend for swift-log, which will forward all messages to CocoaLumberjack's DDLog. You will still configure the loggers and log formatters you want via DDLog, but writing log messages will be done using Logger from swift-log.

In your own log formatters, you can make use of the swiftLogInfo property on DDLogMessage to retrieve the details of a message that is logged via swift-log.

To use swift-log with CocoaLumberjack, take a look the following code snippet to see how to get started.

import CocoaLumberjack
import CocoaLumberjackSwiftLogBackend
import Logging

// In your application's entry point (e.g. AppDelegate):
DDLog.add(DDOSLogger.sharedInstance) // Configure loggers
LoggingSystem.bootstrapWithCocoaLumberjack() // Use CocoaLumberjack as swift-log backend

More information

  • read the Getting started guide, check out the FAQ section or the other docs
  • if you find issues or want to suggest improvements, create an issue or a pull request
  • for all kinds of questions involving CocoaLumberjack, use the Google group or StackOverflow (use #lumberjack).

CocoaLumberjack 3

Migrating to 3.x

  • To be determined

Features

Lumberjack is Fast & Simple, yet Powerful & Flexible.

It is similar in concept to other popular logging frameworks such as log4j, yet is designed specifically for Objective-C, and takes advantage of features such as multi-threading, grand central dispatch (if available), lockless atomic operations, and the dynamic nature of the Objective-C runtime.

Lumberjack is Fast

In most cases it is an order of magnitude faster than NSLog.

Lumberjack is Simple

It takes as little as a single line of code to configure lumberjack when your application launches. Then simply replace your NSLog statements with DDLog statements and that's about it. (And the DDLog macros have the exact same format and syntax as NSLog, so it's super easy.)

Lumberjack is Powerful:

One log statement can be sent to multiple loggers, meaning you can log to a file and the console simultaneously. Want more? Create your own loggers (it's easy) and send your log statements over the network. Or to a database or distributed file system. The sky is the limit.

Lumberjack is Flexible:

Configure your logging however you want. Change log levels per file (perfect for debugging). Change log levels per logger (verbose console, but concise log file). Change log levels per xcode configuration (verbose debug, but concise release). Have your log statements compiled out of the release build. Customize the number of log levels for your application. Add your own fine-grained logging. Dynamically change log levels during runtime. Choose how & when you want your log files to be rolled. Upload your log files to a central server. Compress archived log files to save disk space...

This framework is for you if:

  • You're looking for a way to track down that impossible-to-reproduce bug that keeps popping up in the field.
  • You're frustrated with the super short console log on the iPhone.
  • You're looking to take your application to the next level in terms of support and stability.
  • You're looking for an enterprise level logging solution for your application (Mac or iPhone).

Documentation

readme truncated — read the full docs on github

Frequently asked questions

Is CocoaLumberjack free to use?

CocoaLumberjack is open source under the BSD-3-Clause licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does CocoaLumberjack do?

A fast & simple, yet powerful & flexible logging framework for macOS, iOS, tvOS, watchOS and visionOS

What is CocoaLumberjack written in?

CocoaLumberjack is primarily written in Objective-C. Its source is publicly available at https://github.com/CocoaLumberjack/CocoaLumberjack, and it has 13,319 GitHub stars.