CoAkka Logger

CoAkka Logger reference

Use this guide to understand a record, choose a destination, set limits or diagnose missing logs. Package APIs are shown in Study.

What is in a record?

Level
Choose TRACE/DEBUG for diagnostics, INFO for normal milestones, WARN for recoverable problems and ERROR/FATAL for failures by severity. The level does not stop the application.
Category
A short name for the part of the application, such as orders.checkout. Keep names stable. Put an order ID in the message if the application is allowed to record it.
Message
The application supplies the text. For a JSON message, the application decides its fields and serialization. Omit credentials, private data and large request bodies.
Sequence
A number returned for an accepted record in the current Logger instance. Use it to match the send to the read in one process.
Time
Use wall time to correlate with application events. Where exposed, use monotonic time to compare elapsed time on the same host.

Choose where records go

Think of an order counter. Taking a ticket means the order is in the queue. Picking up the ticket means someone is working on it. Saving the completed receipt takes another step. An accepted log, a dequeued log and a saved log are separate outcomes in the same way.

In manual drain, the application reads records and decides whether to display them, write them or forward them. A read can return no record within its wait time. For a busy server, keep blocking reads and slow output off the request path and give downstream buffers their own limits.

With a managed sink, Logger reads the queue and writes to a configured local file, console, or both, where the package exposes those options. Use sink counters and inspect the destination to confirm writes. Plan permissions, storage limits and retention. For a remote collector or an audit record that must survive a crash, choose an output path with the required acknowledgement and durability guarantees.

Set bounds and filters

Instance name · systemName / system_name
Use a descriptive name for the producer, such as orders-service. Use application correlation IDs to connect logs across services.
Minimum level · minLevel / min_level
Sets the threshold for recording a level. Where the connector exposes a category check or lazy message API, skip expensive formatting when disabled. The check does not reserve capacity.
Queue capacity · queueCapacity / queue_capacity
Maximum queued record count. A larger value absorbs longer bursts and takes more memory. A persistent rise calls for investigating the producer or destination.
Category and message capacity · categoryCapacity / messageCapacity
Separate size limits for the two texts. Account for UTF-8 byte length, especially for accented text. Treat an oversized record as a separate failure from a full queue.
File output settings · native C SDK
Choose sink_mode and, for a file, output_path. max_file_size_bytes governs rotation of the active file, max_total_size_bytes limits space for managed files, and max_archived_files limits archive count. Check effective configuration where exposed and choose limits that match the deployment.

Respond to a full queue

Try a queue of 2 with 8 enabled writes and no reads until the writes finish. This exercise admits 2 records and refuses 6. Then read the 2 accepted records. The example makes the result repeatable; production values depend on traffic and output speed.

  1. Check for a queue-full status or the refusal result documented by the connector.
  2. Count refusals separately from the full queue. Avoid submitting one more log to the same queue for every refusal.
  3. For sustained pressure, reduce noisy events, investigate output latency, or adjust capacity using measurements. Keep any application retry bounded, and decide which events are worth retrying.

Choose a language and open the pressure episode.

Read counters and shut down

queueCapacity / queueDepth / queueHighWatermark
Configured record limit, records waiting now, and the largest queue depth observed in this instance.
emittedCount / deliveredCount
Records admitted and records dequeued. A writer can fail after dequeue. On hosts with snake_case, the same facts appear under names such as emitted_count.
droppedCount
Drops accounted for by Logger. Full queues, Core filtering and pressure policies can contribute. A connector that skips a disabled call may leave Core counters unchanged.
Sink writes and failures
Where available, track successful writes, write failures, file rolls and pressure/emergency state. Inspect the actual destination to distinguish a queue problem from an output problem.
Stop and close
Stop producers first. In manual mode, finish reading required records and complete any application-owned output. Then close. Managed sinks finish through the Logger writer; slow output can lengthen shutdown. Check final counters at the point exposed by the API.

Find the cause of a missing log

Symptom Check and act
Package fails to load or start Check the installed coordinate and version, runtime, OS/CPU, and the native library selected. For managed file output, check the directory and write permissions.
Only lower-level logs are missing Check the effective level and category filter. A disabled call can finish without admission and may be skipped before counting.
Write is refused Read the typed result. Check depth and high-water mark for queue-full. For an oversized record, shorten or summarize the message and check its encoded size.
Read times out Check whether the write was accepted, whether a different consumer already read it and whether the instance is open. A read wait does not cancel an accepted record.
Queue empties, but file or collector is missing data Check sink failures, destination permissions, available storage and downstream acknowledgement. A dequeued counter alone does not confirm a write.
Shutdown takes longer than expected Confirm that producers have stopped. Check the pending queue and the latency of the destination or the application’s consumer before changing limits.

Read the package version and Core identity

Record the exact package from the project or lock file, for example [email protected] or Maven io.github.phuong-tran.coakka:logger:1.2.2. The bundled Logger Core reports 1.2.1; native packages in these exercises use C ABI 10. These numbers describe Logger and are independent of the versions of the two Runtime products.

When reporting a load issue, include the installed package version, the Logger info snapshot (Core version and ABI where exposed), runtime version and OS/CPU. The source label can be unavailable on a packaged host. Use the matching artifact manifest and digest to confirm identity.

Platforms and verification scope

These are Portal lab checks. For deployment, verify the chosen package, operating system, CPU and language runtime in its manifest.

Environment Labs checked
macOS ARM64 Go, Node.js, Bun, Python, Java and Kotlin (Maven and Gradle), .NET, Swift, C/C++, Rust, Zig, Mojo and the Electron desktop window.
Raspberry Pi 5 · Linux ARM64 Python, Bun, C and C++. The native file lab confirmed the counter and the contents of the file.
Tauri · macOS ARM64 The packaged Rust example. WebView and desktop packaging require separate validation.

Glossary

Producer
The application code that submits log records.
Consumer
The code that removes records from the queue. In manual mode, the application owns it.
Sink
The output destination, such as a console or a file.
Pressure
A condition where records arrive faster than they can be read or written, or where the configured output reaches a resource limit.
Drain
Read and finish handling records that were already accepted.
Durability
The guarantee that a recorded result survives specified failures. Verify this at the chosen destination.

Quick reference

Task What to do
Start Choose a package, start one instance, read its configuration where available.
Write Give a level, category and message; check the sequence or refusal.
Read Choose a bounded wait or poll. Compare the record and decide where it goes.
Monitor Watch queue depth, drops and sink failures. Compare rates over the same interval.
Close Stop producers, finish reading or writing required records, close the owner.