Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/create1st/reactor-mdc
Logging, MDC, projectreactor.io
https://github.com/create1st/reactor-mdc
Last synced: about 7 hours ago
JSON representation
Logging, MDC, projectreactor.io
- Host: GitHub
- URL: https://github.com/create1st/reactor-mdc
- Owner: create1st
- License: apache-2.0
- Created: 2019-12-12T18:19:32.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-31T21:36:34.000Z (over 3 years ago)
- Last Synced: 2023-03-02T14:36:18.091Z (over 1 year ago)
- Language: Java
- Size: 22.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# reactor-mdc
This is MDC logging library for [Project Reactor](http://projectreactor.io)# Example logs
Sample pattern is using **ContextFlow** nad **ContextId** properties defined in logger pattern
```
%d{HH:mm:ss.SSS} [%t] [%X{ContextFlow}] [%X{ContextId}] [%-5level] %logger{15} - %msg%n
```
Sample log without **SubscriberContext** set
```java
flux.subscribe();
```
```
21:28:34.399 [main] [] [] [DEBUG] c.c.r.l.m.Demo - 0
21:28:34.399 [main] [] [] [DEBUG] c.c.r.l.m.Demo - 1
21:28:34.399 [main] [] [] [DEBUG] c.c.r.l.m.Demo - 2
21:28:34.399 [main] [] [] [DEBUG] c.c.r.l.m.Demo - 3
21:28:34.399 [main] [] [] [DEBUG] c.c.r.l.m.Demo - 4
21:28:34.399 [main] [] [] [DEBUG] c.c.r.l.m.Demo - 5
21:28:34.399 [main] [] [] [DEBUG] c.c.r.l.m.Demo - 6
21:28:34.399 [main] [] [] [DEBUG] c.c.r.l.m.Demo - 7
21:28:34.399 [main] [] [] [DEBUG] c.c.r.l.m.Demo - 8
21:28:34.400 [main] [] [] [DEBUG] c.c.r.l.m.Demo - 9
21:28:34.400 [main] [] [] [INFO ] c.c.r.l.m.Demo - [1, 3, 5, 7, 9]
21:28:34.400 [main] [] [] [INFO ] c.c.r.l.m.Demo - [0, 2, 4, 6, 8]
```
Sample log with **SubscriberContext** set to **ContextFlow** only
```java
flux.subscriberContext(MdcContext.of(Flow.Numbers))
.subscribe();
```
```
21:28:34.295 [main] [] [] [DEBUG] r.u.Loggers$LoggerFactory - Using Slf4j logging framework
21:28:34.337 [main] [Numbers] [] [DEBUG] c.c.r.l.m.Demo - 0
21:28:34.385 [main] [Numbers] [] [DEBUG] c.c.r.l.m.Demo - 1
21:28:34.385 [main] [Numbers] [] [DEBUG] c.c.r.l.m.Demo - 2
21:28:34.385 [main] [Numbers] [] [DEBUG] c.c.r.l.m.Demo - 3
21:28:34.385 [main] [Numbers] [] [DEBUG] c.c.r.l.m.Demo - 4
21:28:34.386 [main] [Numbers] [] [DEBUG] c.c.r.l.m.Demo - 5
21:28:34.386 [main] [Numbers] [] [DEBUG] c.c.r.l.m.Demo - 6
21:28:34.386 [main] [Numbers] [] [DEBUG] c.c.r.l.m.Demo - 7
21:28:34.386 [main] [Numbers] [] [DEBUG] c.c.r.l.m.Demo - 8
21:28:34.386 [main] [Numbers] [] [DEBUG] c.c.r.l.m.Demo - 9
21:28:34.387 [main] [Numbers] [] [INFO ] c.c.r.l.m.Demo - [1, 3, 5, 7, 9]
21:28:34.388 [main] [Numbers] [] [INFO ] c.c.r.l.m.Demo - [0, 2, 4, 6, 8]
```
Sample log with **SubscriberContext** set to **ContextFlow** and **ContextId**
```java
flux.subscriberContext(MdcContext.of(Flow.Numbers, 1, "TEST"))
.subscribe();
```
```
21:28:34.402 [main] [Numbers] [1,TEST] [DEBUG] c.c.r.l.m.Demo - 0
21:28:34.402 [main] [Numbers] [1,TEST] [DEBUG] c.c.r.l.m.Demo - 1
21:28:34.403 [main] [Numbers] [1,TEST] [DEBUG] c.c.r.l.m.Demo - 2
21:28:34.403 [main] [Numbers] [1,TEST] [DEBUG] c.c.r.l.m.Demo - 3
21:28:34.403 [main] [Numbers] [1,TEST] [DEBUG] c.c.r.l.m.Demo - 4
21:28:34.403 [main] [Numbers] [1,TEST] [DEBUG] c.c.r.l.m.Demo - 5
21:28:34.403 [main] [Numbers] [1,TEST] [DEBUG] c.c.r.l.m.Demo - 6
21:28:34.403 [main] [Numbers] [1,TEST] [DEBUG] c.c.r.l.m.Demo - 7
21:28:34.403 [main] [Numbers] [1,TEST] [DEBUG] c.c.r.l.m.Demo - 8
21:28:34.404 [main] [Numbers] [1,TEST] [DEBUG] c.c.r.l.m.Demo - 9
21:28:34.404 [main] [Numbers] [1,TEST] [INFO ] c.c.r.l.m.Demo - [1, 3, 5, 7, 9]
21:28:34.404 [main] [Numbers] [1,TEST] [INFO ] c.c.r.l.m.Demo - [0, 2, 4, 6, 8]
```