Skip to content

Commit afb9e97

Browse files
committed
Update README.md
Signed-off-by: Dmitry Sulman <[email protected]>
1 parent f2dd1ac commit afb9e97

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

README.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ This library serves as a bridge between the Reactor Netty HTTP logging mechanism
2323
## Dependencies
2424

2525
- Java 17+
26+
- Kotlin Standard Library 2.1.20
2627
- Logback-access 2.0.6
2728
- Reactor Netty HTTP Server 1.2.6
2829
- SLF4J 2.0.17
@@ -57,16 +58,35 @@ HttpServer.create()
5758

5859
The library can be configured in several ways:
5960

60-
1. Default configuration: Uses `logback-access.xml` in the classpath
61-
2. System property: Set `logback.access.reactor.netty.config` to specify configuration file location
62-
3. Programmatic configuration: Provide configuration file URL or filename directly
61+
1. **Default configuration** uses `logback-access.xml` file in the classpath.
62+
2. **System property.** Set `-Dlogback.access.reactor.netty.config` property to specify configuration file location.
63+
3. **Programmatic configuration.** Provide configuration file filename or URL of the resource directly:
6364
```java
64-
// Using specific configuration file
65-
ReactorNettyAccessLogFactory factory = new ReactorNettyAccessLogFactory("custom-config.xml");
65+
// Using specific configuration file by the filename
66+
ReactorNettyAccessLogFactory factory = new ReactorNettyAccessLogFactory("/path/to/logback-access.xml");
67+
68+
// Using specific configuration file as a classpath resource
69+
ReactorNettyAccessLogFactory factory = new ReactorNettyAccessLogFactory(
70+
this.getClass().getClassLoader().getResource("custom-logback-access.xml")
71+
);
72+
6673
// Enable debug mode
67-
ReactorNettyAccessLogFactory factory = new ReactorNettyAccessLogFactory("config.xml", new JoranConfigurator(), true);
74+
ReactorNettyAccessLogFactory factory = new ReactorNettyAccessLogFactory("logback-access.xml", new JoranConfigurator(), true);
75+
```
76+
77+
### Spring Boot configuration
78+
```java
79+
@Configuration
80+
public class NettyAccessLogConfiguration {
81+
@Bean
82+
public NettyServerCustomizer accessLogNettyServerCustomizer() {
83+
return (server) ->
84+
server.accessLog(true, new ReactorNettyAccessLogFactory("path/to/your/logback-access.xml"));
85+
}
86+
}
6887
```
6988

89+
7090
## Author
7191

7292
[Dmitry Sulman](https://www.linkedin.com/in/dmitrysulman/)

0 commit comments

Comments
 (0)