-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Rename logging.file to logging.file.name #15089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
To prevent issues with YAML parsing the `logging.file`, the property `logging.file` should be renamed, because of child properties logging.file.max-history and logging.file.max-size. This (partially) fixes spring-projects#12510
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for opening your first PR to Spring Boot. This looks good and very complete. I am just wondering if we want to have a deprecation phase (i.e. still honouring the former property in a deprecated fashion in 2.2, removing it altogether in the next feature release).
Flagging for team attention to see what the rest of the team thinks.
...roject/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, @TwinProduction.
While this will fix the problem with the YAML structure, I don't think we can change logging.file
and leave logging.path
. logging.path
is also specific to file logging so I think it should also move under logging.file
to logging.file.path
.
@wilkinsona Good point, when I get home, I'll make the change. |
Fixed @wilkinsona |
+1 |
Looks like we have agreement that a deprecation phase would be useful. @TwinProduction Are you interested in also trying to add that to the existing PR? |
Sure, I'll give it a shot. |
@philwebb I've looked around for a bit, and while I could certainly keeping looking for a while, I think it'll be more time efficient if I just ask you directly instead. At a glance, it seems like there's already a property migration implementation that should take care of every properties in the "deprecation": {
"replacement": "..."
} If this is not the case, then can you give me an example of a property that went through a deprecation phase? The only ones I could find after a quick search didn't go through a deprecation phase, such as Alternatively, do you simply want me to just hard code it somewhere? I mean it's certainly easy to add an hard coded block that reads the properties Thanks. |
@TwinProduction the properties migration is yet another thing that we do to help users but we've decided to deprecate this property in 2.2 and remove it in the feature release. Concretely, it means that every place we are looking for We should have tests that set the deprecated property and assert the feature still work as expected. Those tests should be flagged as If you have more questions, please head to Gitter and we can chat. Thanks! |
Also added tests for said change
…solve to empty string
if (!StringUtils.hasText(config)) { | ||
config = environment.resolvePlaceholders( | ||
"${" + LogFile.DEPRECATED_FILE_PROPERTY + ":}"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I changed logging.file.name
for LogFile.DEPRECATED_FILE_PROPERTY
because that field is annotated with @Deprecated
, which will make it easier to find and remove the deprecated code caused by this PR when the deprecation phase is over.
@philwebb @wilkinsona @snicoll What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates. I left a few comments regarding the constants for the property names. Could you take a look and, if you agree, update your proposal accordingly?
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java
Outdated
Show resolved
Hide resolved
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java
Outdated
Show resolved
Hide resolved
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java
Outdated
Show resolved
Hide resolved
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java
Outdated
Show resolved
Hide resolved
@wilkinsona Updated accordingly, let me know what you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great now. Thank you, @TwinProduction. We'll merge this once we've created the 2.1.x branch and master is building 2.2.0 snapshots.
* pr/15089: Polish "Rename logging.file to logging.file.name" Rename logging.file to logging.file.name
@TwinProduction thank you very much for making your first contribution to Spring Boot. I've squashed and polished your contribution on |
As discussed in #12510 with @philwebb:
Using
properties
configuration we can use this:However, using YAML, we cannot set those at the same time without using the following workaround:
Thus, to prevent this specific issue from happening with
logging.file
, I suggestlogging.file
should be renamed tologging.file.name
.Furthermore, I modified
additional-spring-configuration-metadata.json
accordingly:The new property entry:
And to notify users of the breaking change:
This (partially) fixes #12510