Skip to content

Logging a Path object using structured logging throws StackOverflowError #44502

@maxxedev

Description

@maxxedev

Structured logging has infinite loop and throws StackOverflowError when attempting to log a Path object.

Tested with spring-boot 3.4.3 and latest 3.5.0-SNAPSHOT.

Example code:

System.setProperty("logging.structured.format.console", "logstash"); SpringApplication.run(DemoApplication.class, args); LoggerFactory.getLogger(DemoApplication.class).atInfo()	.addKeyValue("foo", Path.of("bar"))	.log("test");

Exception:

Exception in thread "main" java.lang.StackOverflowError	...	at org.springframework.boot.json.JsonValueWriter.append(JsonValueWriter.java:282)	at org.springframework.boot.json.JsonValueWriter.start(JsonValueWriter.java:144)	at org.springframework.boot.json.JsonValueWriter.writeArray(JsonValueWriter.java:168)	at org.springframework.boot.json.JsonValueWriter.write(JsonValueWriter.java:118)	at org.springframework.boot.json.JsonValueWriter.writeElement(JsonValueWriter.java:190) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by anothertype: bugA general bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions