apache / apache/logging-log4j-kotlin

Support LogBuilder API in a kotlin-y way

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
api
Dominant language
Kotlin
Stars
53
Forks
14
PR merge metrics
No merged PRs in 30d

Description

The Kotlin API does not have an equivalent to the https://logging.apache.org/log4j/2.x/manual/logbuilder.html.

A Kotlin-y approach may use a DSL rather than a builder. For example, a `LoggingScope` passed as a lambda receiver could result in an API that could look something like:

```kotlin
logger.atError {
// `this` here is an instance of `LoggingScope`
// everything optional except log
throwable = ...
marker = ...
location = ...
log = ...
}
```

The standard builder API could also be supported as an alternative for users who prefer it.

See also relevant background discussion about designing a fluent logging API from https://github.com/google/flogger and https://google.github.io/flogger/benefits.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing Kotlin API, the linked Log4j LogBuilder documentation, and the Flogger design discussion. Done means agreeing on and implementing a Kotlin-friendly DSL or builder that provides equivalent LogBuilder support, including optional throwable, marker, location, and log values.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.