This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch docs
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/docs by this push:
new 6616808928 TODO-366: consolidate REST-server debug on RichLogger
6616808928 is described below
commit 66168089289ffc2686b555560e5ebf050c8e2fe9
Author: James Bognar <[email protected]>
AuthorDate: Sat Aug 15 14:45:14 2026 -0400
TODO-366: consolidate REST-server debug on RichLogger
Widen RestOpContext.getLogger() to return RichLogger, delete
CapturingRestDebugFormatter and its rest-server test plus the TestBeanStore
overlay, and port the rest-mock end-to-end debug tests to name-based
RichLogger.captureEvents (including the new 404/mixin host-logger-name case).
Keep BasicTestRestDebugFormatter. Update juneau-docs testing topic + 10.0.0
release notes to the RichLogger capture pattern.
---
pages/release-notes/10.0.0.md | 2 ++
pages/topics/10.32.RestServerLoggingAndDebugging.md | 18 +++++++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/pages/release-notes/10.0.0.md b/pages/release-notes/10.0.0.md
index e3395ba4b7..e9381d0a60 100644
--- a/pages/release-notes/10.0.0.md
+++ b/pages/release-notes/10.0.0.md
@@ -1220,6 +1220,8 @@ See
[juneau-rest-server-mcp](/docs/topics/JuneauRestServerMcp#resource-templates
- **`juneau-commons` logging API rename: `Logger` -> `RichLogger` (hard break,
no shim).** The public commons logging type
`org.apache.juneau.commons.logging.Logger` is removed and replaced by
`org.apache.juneau.commons.logging.RichLogger` with no compatibility alias.
Migration is mechanical for most call sites: update imports and static
factories (`Logger.getLogger(...)` -> `RichLogger.getLogger(...)`). The rename
ships with new logging capabilities: `MessageGenerator`-driven formatting [...]
+- **REST debug test capture consolidated onto `RichLogger`
(`juneau-rest-server` / `juneau-rest-mock`).**
`org.apache.juneau.rest.server.logging.CapturingRestDebugFormatter` and its
dedicated rest-server Mockito unit test are removed. The replacement capture
path is logger-name based: capture on the resource logger with
`RichLogger.getLogger(MyResource.class).captureEvents(Level.FINEST)` and assert
against captured `LogRecord`s. This captures both op-routed records
(`<hostResourceClass>. [...]
+
- **`LogRecord.formatted(...)` no longer supports source-detection
placeholders (behavioral change).**
`org.apache.juneau.commons.logging.LogRecord` removed its unreliable JUL-style
stack-walk source detection — the `findSource()` walk and the
`getSourceClassName()` / `getSourceMethodName()` overrides — along with the
`{source}`, `{class}`, and `{method}` named placeholders in
`formatted(String)`. As a result, positional `%N$s` `Formatter`-style
specifiers passed to `formatted(...)` shif [...]
- **Serializer/Parser I/O narrowed to streams — `File` and `StringBuilder` no
longer accepted (TODO-248).** The core serialize/parse I/O surface now accepts
only `Reader` / `Writer` / `InputStream` / `OutputStream` (plus the existing
scalar `String` / `byte[]` / `CharSequence` shortcut forms). The `File` and
`StringBuilder` `instanceof` branches were removed from the internal
`SerializerPipe` / `ParserPipe` I/O plumbing, so passing a `File` or
`StringBuilder` to `Serializer.write(Object, [...]
diff --git a/pages/topics/10.32.RestServerLoggingAndDebugging.md
b/pages/topics/10.32.RestServerLoggingAndDebugging.md
index d331997c3f..e0a4477fb5 100644
--- a/pages/topics/10.32.RestServerLoggingAndDebugging.md
+++ b/pages/topics/10.32.RestServerLoggingAndDebugging.md
@@ -162,11 +162,19 @@ sensitive-header redaction that applies to the
echoed-back request as well.
## Testing
-`juneau-rest-mock` ships a capturing `RestDebugFormatter` test variant with
`assertMessage()`/`assertThrown()`-style
-helpers, so tests can assert on the exact log content a request would have
produced without wiring up real JUL
-handlers. Pair it with the mock request's `logLevel(Level)` helper, which sets
the resolved logger's level for the
-duration of a single mocked call (and restores it afterward) — the mock
equivalent of editing
-`logging.properties`, without needing a boolean debug flag.
+Capture debug output by logger name with `RichLogger`:
+
+```java
+try (var c =
RichLogger.getLogger(MyResource.class).captureEvents(Level.FINEST)) {
+ client.get("/who").run();
+ assertTrue(c.last().getMessage().contains("[200] HTTP GET /api/who"));
+}
+```
+
+`captureEvents(Level.FINEST)` is the right threshold for
`.debug()`/`logLevel(FINEST)` mock flows, since debug
+records are emitted at `FINEST`. Pair this with the mock request's
`logLevel(Level)` helper to set the resolved
+logger level for one call (and restore it afterward) — the mock equivalent of
editing `logging.properties` without
+introducing a separate boolean debug flag.
## Migrating from pre-10.0