Logging

Structured logging with database persistence, filtering, and a web UI.

How it works

The logging module provides a Logback appender that persists log entries to your database. Entries are searchable, filterable, and viewable through a built-in web UI.

Setting up the appender

Add the database log appender in your Ktor application module. It captures Logback events at or above the specified level and writes them to the configured storage backend.

fun Application.module() = app.module(this) { app, config, init ->
    // Persist log entries at INFO level and above to ArangoDB
    addKarangoAppender(config = config.arangodb, minLevel = Level.INFO)

    // ... rest of your server setup
}

Choosing a storage backend

Configure the storage backend in your Kontainer blueprint. The logging module supports ArangoDB and MongoDB out of the box.

val blueprint = kontainer {
    funktor(
        config = config,
        logging = {
            useKarango()   // ArangoDB via Karango
            // or
            // useMonko()  // MongoDB via Monko
        },
        // ... other modules
    )
}

Features

Database-backed

Log entries stored in ArangoDB or MongoDB. Survives restarts. Searchable by level, logger, message, and timestamp.

Web UI

Browse, search, and filter logs from the admin panel. Pre-built Kraft components for log list and detail views.

Bulk actions

Acknowledge, archive, or delete log entries in batch through the web UI or REST API.

REST API

Query logs programmatically via LoggingApiClient. Filter by severity, date range, or search text.

The appender hooks into Logback, so any library that logs through SLF4J automatically gets its entries persisted. No code changes needed in your application logic.