Skip to content

Commit 6a7bf3b

Browse files
committed
fix - MDC class set to open
1 parent 5717076 commit 6a7bf3b

File tree

3 files changed

+42
-16
lines changed

3 files changed

+42
-16
lines changed

README.md

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
_After releases, SonaType or mvnrepostiroy may not appear. Regardless, the package is available._
1212

13-
## Important
13+
# Important
1414

1515
This is just a hobby project driven by self motivation. There is no external sponsor behind the project.
1616

17-
## What is the source of motivation?
17+
# What is the source of motivation?
1818

1919
I think this description approaches
2020
the [What Is a Good Pattern for Contextual Logging? (MDC)](https://projectreactor.io/docs/core/release/reference/#faq.mdc) well.
@@ -42,7 +42,7 @@ the following: MDC context data slipping to another request. I think it is unhea
4242
So, I have been working to create an API for Reactor and Coroutine what solve the above problems. It provides the same interfaces to both
4343
environments and follows Reactor MDC documentation.
4444

45-
## Overview
45+
# Overview
4646

4747
_Part of the documentation and description comes from: [README.md](https://github.com/johncfranco/reactive-logger/blob/develop/README.md)_
4848

@@ -58,31 +58,57 @@ The library has many goals:
5858
* Obey the rule restricting blocking I/O to bounded elastic schedulers without requiring a specific logging configuration to do so.
5959
* Provide the appropriate language approach for Java Reactor or Kotlin Coroutine code.
6060

61-
## Documentation
62-
63-
- [Wiki](https://github.com/Numichi/reactive-logger/wiki/Documentation)
64-
- [Kotlin example](https://github.com/Numichi/reactive-logger-kotlin-example/tree/main/src/main/kotlin/io/github/numichi/reactive/logger/kotlin/example)
65-
66-
## Dependency
61+
# Dependency
6762

6863
### Maven
6964

7065
```xml
66+
7167
<dependency>
7268
<groupId>io.github.numichi</groupId>
7369
<artifactId>reactive-logger</artifactId>
74-
<version>VERSION</version>
70+
<version>2.0.0</version>
7571
</dependency>
7672
```
7773

7874
### Gradle Groovy DSL
7975

80-
```gradle
81-
implementation 'io.github.numichi:reactive-logger:VERSION'
76+
```groovy
77+
implementation 'io.github.numichi:reactive-logger:2.0.0'
8278
```
8379

8480
### Gradle Kotlin DSL
8581

86-
```gradle
87-
implementation("io.github.numichi:reactive-logger:VERSION")
82+
```kotlin
83+
implementation("io.github.numichi:reactive-logger:2.0.0")
8884
```
85+
86+
# Usage
87+
88+
## Logger library
89+
90+
Because it is a layer on slf4j so you can use specific logger libraries like Backlog, Log4j2 and so on. By default, Spring uses the Backlog log library. So, if you don't would like to apply anything
91+
else, you don't need additional dependencies.
92+
93+
### Log4j2
94+
95+
When using Log4j2 you should 2 things. You have to deactivate Logback and import Log4j2 dependency. Configure log4j2.xml as required. But it is already
96+
a [configuration](https://logging.apache.org/log4j/2.x/manual/configuration.html) of the logger library.
97+
98+
Many documentation can be found on the internet ([here](https://www.callicoder.com/spring-boot-log4j-2-example/) and [here](https://www.baeldung.com/spring-boot-logging)) on how can you change from
99+
Logback to Log4j2. The articles mainly use XML configuration, so I presented an example with Gradle Kotlin DSL configuration.
100+
101+
```kotlin
102+
configurations {
103+
all {
104+
exclude("org.springframework.boot", "spring-boot-starter-logging")
105+
}
106+
}
107+
108+
dependencies {
109+
implementation("org.springframework.boot:spring-boot-starter-log4j2")
110+
}
111+
```
112+
113+
# How use `reactive-logger`
114+
_In writing_

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=2.0.0
1+
version=2.0.1
22
group=io.github.numichi
33
developerId=numichi
44
developerName=Donát Csongor

src/main/java/io/github/numichi/reactive/logger/MDC.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package io.github.numichi.reactive.logger
33
import io.github.numichi.reactive.logger.DefaultValues.Companion.getInstance
44
import java.util.concurrent.ConcurrentHashMap
55

6-
class MDC(contextKey: String?, mdcMap: Map<String, String>) : ConcurrentHashMap<String, String>() {
6+
open class MDC(contextKey: String?, mdcMap: Map<String, String>) : ConcurrentHashMap<String, String>() {
77
val contextKey: String
88

99
constructor() : this(null, mapOf())

0 commit comments

Comments
 (0)