Skip to content

Commit 9772eda

Browse files
authored
Merge pull request #55 from 398ja/release/0.1.4
Add logging enhancements and documentation updates
2 parents b84f0ea + 76b528a commit 9772eda

16 files changed

Lines changed: 124 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,9 @@
5858

5959
### Notes
6060
- Enable debug logs with `logging.level.xyz.tcheeric=DEBUG` to see detailed request and configuration traces.
61+
## 0.1.4 — 2025-09-13
62+
63+
### Enhancements
64+
- Add default logging configuration for SLF4J Simple in phoenixd-rest (`simplelogger.properties`).
65+
- Document logging usage and configuration.
6166

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ version and `latest`, allowing consumers to pull the most recent build without s
4646
- [Docker](docs/how-to/docker.md)
4747
- [Code coverage](docs/how-to/coverage.md)
4848
- [Release](docs/how-to/release.md)
49+
- [Logging](docs/reference/logging.md)

docs/reference/logging.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Logging
2+
3+
phoenixd-rest and phoenixd-base use SLF4J for logging with Lombok's `@Slf4j`.
4+
This lets your application choose the logging backend (Logback, Log4j2, slf4j-simple, etc.).
5+
6+
## Quick Start (slf4j-simple)
7+
8+
If your app does not already have a logging backend, add:
9+
10+
```xml
11+
<dependency>
12+
<groupId>org.slf4j</groupId>
13+
<artifactId>slf4j-simple</artifactId>
14+
<version>${slf4j.version}</version>
15+
</dependency>
16+
```
17+
18+
The module ships a `simplelogger.properties` that sets:
19+
20+
- `org.slf4j.simpleLogger.defaultLogLevel=info`
21+
- `org.slf4j.simpleLogger.log.xyz.tcheeric=debug`
22+
- date/time and thread name output
23+
24+
Override levels at runtime with system properties, for example:
25+
26+
```bash
27+
JAVA_TOOL_OPTIONS="-Dorg.slf4j.simpleLogger.defaultLogLevel=info \
28+
-Dorg.slf4j.simpleLogger.log.xyz.tcheeric=debug"
29+
```
30+
31+
## Spring Boot (Logback)
32+
33+
Add to `application.properties`:
34+
35+
```
36+
logging.level.xyz.tcheeric=DEBUG
37+
```
38+
39+
Or to `logback-spring.xml`:
40+
41+
```xml
42+
<configuration>
43+
<logger name="xyz.tcheeric" level="DEBUG"/>
44+
<root level="INFO">
45+
<appender-ref ref="CONSOLE"/>
46+
</root>
47+
</configuration>
48+
```
49+
50+
## What’s Logged
51+
52+
- HTTP requests: method, URI, timeout, status; error responses include a truncated body.
53+
- Configuration resolution: whether values come from ENV, system properties, or `app.properties` (base module).
54+
- Request factory decisions: Lightning address vs BOLT11 detection.
55+
56+
Sensitive values (e.g. Authorization) are redacted.
57+

phoenixd-base/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>xyz.tcheeric</groupId>
66
<artifactId>phoenixd-java</artifactId>
7-
<version>0.1.3</version>
7+
<version>0.1.4</version>
88
</parent>
99

1010
<artifactId>phoenixd-base</artifactId>

phoenixd-mock/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>xyz.tcheeric</groupId>
88
<artifactId>phoenixd-java</artifactId>
9-
<version>0.1.3</version>
9+
<version>0.1.4</version>
1010
</parent>
1111

1212
<artifactId>phoenixd-mock</artifactId>

phoenixd-model/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>xyz.tcheeric</groupId>
66
<artifactId>phoenixd-java</artifactId>
7-
<version>0.1.3</version>
7+
<version>0.1.4</version>
88
</parent>
99

1010
<artifactId>phoenixd-model</artifactId>

phoenixd-rest/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<parent>
55
<groupId>xyz.tcheeric</groupId>
66
<artifactId>phoenixd-java</artifactId>
7-
<version>0.1.3</version>
7+
<version>0.1.4</version>
88
</parent>
99

1010
<artifactId>phoenixd-rest</artifactId>
1111
<packaging>jar</packaging>
12-
<version>0.1.3</version>
12+
<version>0.1.4</version>
1313
<name>phoenixd-rest</name>
1414
<url>https://maven.apache.org</url>
1515

phoenixd-rest/src/main/java/xyz/tcheeric/phoenixd/operation/impl/DeleteOperation.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import lombok.NonNull;
44
import lombok.SneakyThrows;
5+
import lombok.extern.slf4j.Slf4j;
56
import xyz.tcheeric.phoenixd.common.rest.Operation;
67
import xyz.tcheeric.phoenixd.common.rest.Request;
78
import xyz.tcheeric.phoenixd.common.rest.util.Constants;
@@ -11,6 +12,7 @@
1112
import java.net.http.HttpRequest;
1213
import java.net.http.HttpRequest.Builder;
1314

15+
@Slf4j
1416
public class DeleteOperation extends AbstractOperation {
1517

1618
public DeleteOperation(HttpRequest httpRequest) {
@@ -20,11 +22,13 @@ public DeleteOperation(HttpRequest httpRequest) {
2022
@SneakyThrows
2123
public DeleteOperation(@NonNull String path) {
2224
super(Constants.HTTP_DELETE_METHOD, path, null);
25+
if (log.isDebugEnabled()) log.debug("Initialized DELETE operation for path={}", path);
2326
}
2427

2528
@SneakyThrows
2629
public DeleteOperation(@NonNull String path, @NonNull Request.Param requestParam) {
2730
super(Constants.HTTP_DELETE_METHOD, path, requestParam, null);
31+
if (log.isDebugEnabled()) log.debug("Initialized DELETE operation for path={} with params", path);
2832
}
2933

3034
@Override
@@ -40,11 +44,12 @@ public Operation removeHeader(@NonNull String key) {
4044
});
4145

4246
this.httpRequest = requestBuilder.build();
47+
if (log.isDebugEnabled()) log.debug("Removed header '{}' from DELETE request {} {}", key, httpRequest.method(), httpRequest.uri());
4348
return this;
4449
}
4550

4651
@Override
4752
public Operation addHeader(String key, String value) {
4853
throw new UnsupportedOperationException("Not supported yet.");
4954
}
50-
}
55+
}

phoenixd-rest/src/main/java/xyz/tcheeric/phoenixd/operation/impl/GetOperation.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
import lombok.NonNull;
44
import lombok.SneakyThrows;
5+
import lombok.extern.slf4j.Slf4j;
56
import xyz.tcheeric.phoenixd.common.rest.Request;
67
import xyz.tcheeric.phoenixd.common.rest.util.Constants;
78
import xyz.tcheeric.phoenixd.operation.AbstractOperation;
89

910
import java.net.http.HttpRequest;
1011

12+
@Slf4j
1113
public class GetOperation extends AbstractOperation {
1214

1315
public GetOperation(HttpRequest httpRequest) {
@@ -17,10 +19,12 @@ public GetOperation(HttpRequest httpRequest) {
1719
@SneakyThrows
1820
public GetOperation(@NonNull String path) {
1921
super(Constants.HTTP_GET_METHOD, path, null);
22+
if (log.isDebugEnabled()) log.debug("Initialized GET operation for path={}", path);
2023
}
2124

2225
@SneakyThrows
2326
public GetOperation(@NonNull String path, @NonNull Request.Param requestParam) {
2427
super(Constants.HTTP_GET_METHOD, path, requestParam, null);
28+
if (log.isDebugEnabled()) log.debug("Initialized GET operation for path={} with params", path);
2529
}
2630
}

phoenixd-rest/src/main/java/xyz/tcheeric/phoenixd/operation/impl/PatchOperation.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@
22

33
import lombok.NonNull;
44
import lombok.SneakyThrows;
5+
import lombok.extern.slf4j.Slf4j;
56
import xyz.tcheeric.phoenixd.common.rest.Operation;
67
import xyz.tcheeric.phoenixd.common.rest.Request;
78
import xyz.tcheeric.phoenixd.common.rest.util.Constants;
89
import xyz.tcheeric.phoenixd.operation.AbstractOperation;
910

11+
@Slf4j
1012
public class PatchOperation extends AbstractOperation {
1113

1214
@SneakyThrows
1315
public PatchOperation(@NonNull String path) {
1416
super(Constants.HTTP_PATCH_METHOD, path, null);
17+
if (log.isDebugEnabled()) log.debug("Initialized PATCH operation for path={}", path);
1518
}
1619

1720
@SneakyThrows
1821
public PatchOperation(@NonNull String path, @NonNull Request.Param param) {
1922
super(Constants.HTTP_PATCH_METHOD, path, param, null);
23+
if (log.isDebugEnabled()) log.debug("Initialized PATCH operation for path={} with params", path);
2024
}
2125

2226
@Override
@@ -26,6 +30,7 @@ public Operation removeHeader(String key) {
2630

2731
@Override
2832
public Operation addHeader(String key, String value) {
33+
if (log.isDebugEnabled()) log.debug("Adding header on PATCH operation: {}=<redacted? {}>", key, key.equalsIgnoreCase("Authorization") ? "yes" : "no");
2934
return super.addHeader(key, value);
3035
}
3136

0 commit comments

Comments
 (0)