openrewrite / openrewrite/rewrite-spring

spring-boot-22 Recipe messes up logging.file.* in application.yaml

Open
#436 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

boot-2.2 bug
Dominant language
Java
Stars
403
Forks
149
Avg merge
2h 33m
Merged PRs (30d)
10

Description

I am using the shell command from https://docs.openrewrite.org/recipes/java/spring/boot2/upgradespringboot_2_2#usage

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE \
  -Drewrite.activeRecipes=org.openrewrite.java.spring.boot2.UpgradeSpringBoot_2_2

to migrate a project from 2.1.18.RELEASE to latest 2.2.

Using maven 3.9.4 and java 11.0.20.1-tem

The application.yaml file looks like this before:

logging:
  file:
    max-history: 10
    max-size: 10MB
  level:
    org: INFO
  path: ${user.home}/some-folder

but after running above OpenRewrite recipe it looks like this:

logging:
  file.name:                      # ⚡️
    max-history: 10
    max-size: 10MB
  level:
    org: INFO
  file.name.path: ${user.home}/some-folder  # ⚡️

The correct result of course would be:

logging:
  file:
    max-history: 10
    max-size: 10MB
    path: ${user.home}/some-folder
  level:
    org: INFO

this seems to be closely connected to #432 – very similar problem, but this time with a yaml style configuration file.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the documented UpgradeSpringBoot_2_2 recipe command against the application.yaml example, then locate the UpgradeSpringBoot_2_2 recipe and its YAML handling. Done means the recipe preserves the logging.file mapping and moves path under it without producing file.name.path; add a regression test for the reported input and expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot, yaml
Domain
backend, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.