Skip to content
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

Skip redundant LoggerContext reset #41910

Closed

Conversation

mches
Copy link
Contributor

@mches mches commented Aug 16, 2024

Skips a redundant call to LoggerContext#reset().

  • Prior to Logback 1.5.7, calling #stop() on any LoggerContext implicitly called #reset(). On the other hand, since Logback 1.5.7, only calling #stop() on a started LoggerContext implicitly calls #reset(). Going forward, given the next version of Spring Boot will not be binary or source compatible with Logback 1.5.6 and earlier, it's only necessary to call #reset() on a stopped LoggerContext.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 16, 2024
Copy link
Member

@philwebb philwebb left a 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. I've added a couple of issues to review.

*/
@ExtendWith(OutputCaptureExtension.class)
@ExtendWith({ MockitoExtension.class, OutputCaptureExtension.class })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change accidental? It doesn't seem related to the other changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appeared in #41885, which was reverted.

Without this, I ran into this issue in my environment, which failed the tests that use Mockito.mock within this class for being unable to delete mockitoboot*.jar from the JUnit temp directory.

With the change, the test is less finicky on Windows.

That said, I can take it out if required.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's needed. Regardless, it isn't related to this change so I think it should be taken out. #41905 has hopefully helped here.

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There doesn't seem to be any changes in this file so the copyright header should not be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was updated in #41885, which was reverted, but updated again without updating the years. So I feel it's accurate, but I'm happy to take it out if required.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have bumped the year as part of dd2ed5f. That should now be done separately as it isn't related to this change so please take it out of this PR.

@philwebb
Copy link
Member

Going forward, given the next version of Spring Boot will not be binary or source compatible with Logback 1.5.6 and earlier

Is this the case? Is Logback 1.5.7 not binary compatible with Logback 1.5.6?

@mches
Copy link
Contributor Author

mches commented Aug 16, 2024

Thanks for the review 🙇‍♂️

@mches
Copy link
Contributor Author

mches commented Aug 16, 2024

Going forward, given the next version of Spring Boot will not be binary or source compatible with Logback 1.5.6 and earlier

Is this the case? Is Logback 1.5.7 not binary compatible with Logback 1.5.6?

Yes, because the return type of LoggerContext#getConfigurationLock() changed from Object to ReentrantLock. It's source compatible, but not binary compatible.

Spring Boot 3.3.2 with Logback 1.5.7 blows up with NoSuchMethodError merely loading the application context.

@philwebb philwebb added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 17, 2024
@philwebb philwebb added this to the 3.3.x milestone Aug 17, 2024
@snicoll
Copy link
Member

snicoll commented Aug 17, 2024

So this is in addition of the actual upgrade to Logback then?

*/
@ExtendWith(OutputCaptureExtension.class)
@ExtendWith({ MockitoExtension.class, OutputCaptureExtension.class })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's needed. Regardless, it isn't related to this change so I think it should be taken out. #41905 has hopefully helped here.

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have bumped the year as part of dd2ed5f. That should now be done separately as it isn't related to this change so please take it out of this PR.

@mches
Copy link
Contributor Author

mches commented Aug 17, 2024

So this is in addition of the actual upgrade to Logback then?

Yes, I thought this made sense to do after reviewing dd2ed5f.

@mches mches force-pushed the feature/upgrade-logback-v3 branch from 4589afb to 16f2696 Compare August 17, 2024 13:12
@mches
Copy link
Contributor Author

mches commented Aug 17, 2024

Thank you for the review. 🙇🏻 All feedback has been implemented. ✨🧹

@wilkinsona
Copy link
Member

I think we should leave this as-is. Arguably, calling both stop() and then reset() has been unnecessary for some time as in 1.5.6 and earlier versions a call to stop() will also call reset() but it hasn't caused any problems.

In 1.5.7, stop() will only call reset() if the context is started. A context is started in its constructor so, if it isn't started, it must have already been stopped and, therefore, must have already been reset. I think that means that we could, perhaps, do nothing at all if the context isn't started. It's hard to justify making a change as there doesn't appear to be any benefit yet there is some risk in making the change. I'm going to close this one, for now at least. We can reconsider in the future and perhaps do nothing at all if the context isn't started. Thanks anyway, @mches.

@wilkinsona wilkinsona closed this Aug 19, 2024
@wilkinsona wilkinsona removed this from the 3.3.x milestone Aug 19, 2024
@wilkinsona wilkinsona added the status: declined A suggestion or change that we don't feel we should currently apply label Aug 19, 2024
@mches mches deleted the feature/upgrade-logback-v3 branch October 13, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants