Skip to content

Commit 0b8d998

Browse files
committed
wip
1 parent 91367bb commit 0b8d998

3 files changed

Lines changed: 338 additions & 61 deletions

File tree

json-java21-schema/AGENTS.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,42 @@ mvnd verify -pl json-java21-schema
2929
### Logging Configuration
3030
The project uses `java.util.logging` with levels:
3131
- `FINE` - Schema compilation and validation flow
32-
- `FINER` - Conditional validation branches
32+
- `FINER` - Conditional validation branches
3333
- `FINEST` - Stack frame operations
3434

35+
#### Two-Level Logging Strategy
36+
Use **FINE** for general flow visibility and **FINER** for detailed debugging:
37+
```bash
38+
# General flow - good for understanding compilation/validation patterns
39+
mvnd test -pl json-java21-schema -Dtest=JsonSchemaTest#testMethod -Djava.util.logging.ConsoleHandler.level=FINE
40+
41+
# Detailed debugging - use when tracing specific execution paths
42+
mvnd test -pl json-java21-schema -Dtest=JsonSchemaTest#testMethod -Djava.util.logging.ConsoleHandler.level=FINER
43+
```
44+
45+
#### Systematic Debugging Approach
46+
When code isn't being reached, use systematic logging rather than guessing:
47+
1. Add FINE or logging at entry points
48+
2. Add FINER logging at key decision points in the call stack
49+
3. Use binary search approach - add logging halfway between working and non-working code
50+
4. Text-based minds excel at processing log output systematically
51+
52+
You also need to ensure that the test class extends `JsonSchemaLoggingConfig` to honour the system property:
53+
```java
54+
/// Test local reference resolution for JSON Schema 2020-12
55+
class JsonSchemaRefLocalTest extends JsonSchemaLoggingConfig {
56+
...
57+
}
58+
```
59+
60+
IMPORTANT:
61+
62+
- Always adjust the logging levels to be balanced before committing code.
63+
- NEVER comment out code.
64+
- NEVER use System.out.println or e.printStackTrace().
65+
- ALWAYS use lamba based JUL logging.
66+
- NEVER filter logging output with head, tail, grep, etc. You shoould set the logging to the correct level of INFO, FINE, FINER, FINEST and run just the one test or method with the correct logging level to control token output.
67+
3568
### Test Organization
3669

3770
#### Unit Tests (`JsonSchemaTest.java`)

0 commit comments

Comments
 (0)