Skip to content

LogFormatUtils.formatValue does not leniently handle toString() exceptions [SPR-17397] #21930

@spring-projects-issues

Description

@spring-projects-issues

Hans opened SPR-17397 and commented

Steps to reproduce:

  1. create two entities with a JPA-one-to-many-relationship between the two
  2. annotate both classes with lombok's @Data (generating e.g. toString())
  3. set logging.level.org.springframework.web to DEBUG
  4. POST a new child object with a parent reference
  5. Spot the exception. In my case, backend state was correct, frontend stopped working.

Lombok's autogenerated toString() methods probably result in an endless loop in this call:

String s = (value instanceof CharSequence ? "\"" + value + "\"" : value.toString());

Besides excluding some fields from being toStringified() by lombok, this method probably shouldn't throw an error in any case so you might consider try-catching the call.


Affects: 5.1.1

Referenced from: commits 7ff938b

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions