You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Java/Kotlin library that integrates Logback Access with Reactor Netty HTTP server, providing comprehensive access logging capabilities.
8
+
A Java/Kotlin library and Spring Boot Starter that integrates Logback Access with Reactor Netty HTTP server, providing comprehensive access logging capabilities for reactive web applications.
9
+
10
+
## Contents:
11
+
12
+
-[Overview](#overview)
13
+
-[Features](#features)
14
+
-[Usage](#usage)
15
+
-[Using as a Spring Boot Starter](#using-as-a-spring-boot-starter)
16
+
-[Adding Spring Boot Starter to your project](#adding-spring-boot-starter-to-your-project)
@@ -17,43 +36,108 @@ A Java/Kotlin library that integrates Logback Access with Reactor Netty HTTP ser
17
36
18
37
## Features
19
38
39
+
- Spring Boot Starter with auto-configuration
20
40
- XML-based configuration support
21
41
- Comprehensive HTTP request/response logging
22
42
- Lazy-loaded access event properties for optimal performance
23
43
- Support for headers, cookies, and request parameters logging
24
44
- Configurable through system properties or external configuration files
25
45
- Debug mode for troubleshooting
26
46
27
-
## Dependencies
47
+
## Usage
48
+
49
+
The Logback Access integration with Reactor Netty can be used in two ways:
50
+
51
+
1. As a Spring Boot Starter for reactive Spring Boot applications based on `spring-boot-starter-webflux`.
52
+
2. As a standalone library for applications using Reactor Netty HTTP Server directly.
53
+
54
+
## Using as a Spring Boot Starter
55
+
56
+
### Adding Spring Boot Starter to your project
57
+
58
+
The Spring Boot Starter is published on [Maven Central](https://central.sonatype.com/artifact/io.github.dmitrysulman/logback-access-reactor-netty-spring-boot-starter). To add the dependency, use the following snippet according to your build system:
Default Spring Boot auto-configuration uses the `logback-access.xml` file from the current directory or the classpath, with a fallback to the [Common Log Format](https://en.wikipedia.org/wiki/Common_Log_Format).
78
+
79
+
#### Application properties
80
+
81
+
Several application properties can be specified inside `application.properties` file or `application.yaml` file, or as command line arguments:
The `<springProfile>` tag allows you to conditionally include or exclude parts of the configuration based on the active Spring profiles. You can use it anywhere within the `<configuration>` element. Specify the applicable profile using the `name` attribute, which can be either a single profile name (e.g., `staging`) or a profile expression. For more details, see the [Spring Boot Logback Extensions Profile-specific Configuration reference guide](https://docs.spring.io/spring-boot/reference/features/logging.html#features.logging.logback-extensions.profile-specific), which describes the same usage. There are several examples:
92
+
93
+
```xml
94
+
<springProfilename="staging">
95
+
<!-- configuration to be enabled when the "staging" profile is active -->
96
+
</springProfile>
97
+
98
+
<springProfilename="dev | staging">
99
+
<!-- configuration to be enabled when the "dev" or "staging" profiles are active -->
100
+
</springProfile>
101
+
102
+
<springProfilename="!production">
103
+
<!-- configuration to be enabled when the "production" profile is not active -->
104
+
</springProfile>
105
+
```
106
+
107
+
### Dependencies
28
108
29
109
- Java 17+
30
110
- Kotlin Standard Library 2.1.21
31
-
-Reactor Netty HTTP Server 1.2.6+ (should be explicitly provided)
111
+
-Spring Boot Starter WebFlux 3.4.6+ (should be explicitly provided)
32
112
- Logback-access 2.0.6
33
113
- SLF4J 2.0.17
34
114
35
-
## Usage
115
+
## Using as a standalone library
36
116
37
-
### Adding dependency
117
+
### Adding dependency to your project
118
+
119
+
The library is published on [Maven Central](https://central.sonatype.com/artifact/io.github.dmitrysulman/logback-access-reactor-netty). To add the dependency, use the following snippet according to your build system:
To enable Logback Access integration with Reactor Netty, create a new instance of `ReactorNettyAccessLogFactory` and pass it to the `HttpServer.accessLog()` method.
140
+
57
141
#### Java
58
142
59
143
```java
@@ -67,6 +151,8 @@ HttpServer.create()
67
151
68
152
#### Kotlin
69
153
154
+
For Kotlin, a convenient [enableLogbackAccess()](https://dmitrysulman.github.io/logback-access-reactor-netty/logback-access-reactor-netty/io.github.dmitrysulman.logback.access.reactor.netty/enable-logback-access.html) extension function is provided to pass the factory instance.
155
+
70
156
```kotlin
71
157
val factory =ReactorNettyAccessLogFactory()
72
158
HttpServer.create()
@@ -76,13 +162,14 @@ HttpServer.create()
76
162
.block()
77
163
```
78
164
79
-
### Configuration
165
+
### Customize Logback Access configuration
80
166
81
167
The library can be configured in several ways:
82
168
83
-
1.**Default configuration** uses the `logback-access.xml` file from the classpath or the current directory, with a fallback to the [Common Log Format](https://en.wikipedia.org/wiki/Common_Log_Format).
169
+
1.**Default configuration** uses the `logback-access.xml` file from the current directory or the classpath, with a fallback to the [Common Log Format](https://en.wikipedia.org/wiki/Common_Log_Format).
84
170
2.**System property.** Set `-Dlogback.access.reactor.netty.config` property to specify configuration file location.
85
171
3.**Programmatic configuration.** Provide configuration file filename or URL of the classpath resource directly:
172
+
86
173
```java
87
174
// Using specific configuration file by the filename
88
175
var factory =newReactorNettyAccessLogFactory("/path/to/logback-access.xml");
@@ -93,44 +180,25 @@ var factory = new ReactorNettyAccessLogFactory(
See [enableLogbackAccess()](https://dmitrysulman.github.io/logback-access-reactor-netty/logback-access-reactor-netty/io.github.dmitrysulman.logback.access.reactor.netty/enable-logback-access.html) extension function documentation.
185
+
- Java 17+
186
+
- Kotlin Standard Library 2.1.21
187
+
- Reactor Netty HTTP Server 1.2.6+ (should be explicitly provided)
188
+
- Logback-access 2.0.6
189
+
- SLF4J 2.0.17
123
190
124
-
## Documentation
191
+
## API documentation
125
192
126
-
-[Java API (Javadoc)](https://javadoc.io/doc/io.github.dmitrysulman/logback-access-reactor-netty/latest/index.html)
193
+
-[Java API (Javadoc) - Spring Boot Starter](https://javadoc.io/doc/io.github.dmitrysulman/logback-access-reactor-netty-spring-boot-starter/latest/index.html)
194
+
-[Java API (Javadoc) - Standalone library](https://javadoc.io/doc/io.github.dmitrysulman/logback-access-reactor-netty/latest/index.html)
127
195
-[Kotlin API (KDoc)](https://dmitrysulman.github.io/logback-access-reactor-netty/)
0 commit comments