Added Slf4jBindingChecker
All Submissions:
- [YES] I have added an explanation of what changes in this merge do and why we should include it?
- [NO] I have updated the documentation accordingly.
- [NO] I have added tests to cover my changes.
- [YES] All new and existing tests passed.
- [YES] My code follows the code style of this project.
- [NA] I ran lint checks locally prior to submission.
What is the issue or story related to the change?
High level design: Added logic to throw exception at application start if slf4j is not bound to log4j2
Issue: If there are multiple bindings available for slf4j, then the binding with log4j2 breaks and consequently the integration with appinsights also breaks. Till date only a warning was being thrown in this scenario, and the application would run without logs going to appinsights. There is a need to fail the application if appinsights integration is broken in such a way.
Change details:
- Added component Slf4jBindingChecker
- This component contains a method - performCheck() - that checks the slf4j binding with log4j2, just after the component is initialized as it is annotated with '@PostConstruct'
- Method performCheck() throws a RunTimeException with appropriate error message if binding is not correct. This happens at application startup.
Test coverage:
Not added
Does this introduce a breaking change?
- NO
Pending items
NA
Reviewer request
- Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
- Block the MR if you feel there is less testing or no details in the MR
- Please cover the following aspects in the MR -- Coding design: <Reviewer1> -- Backward Compatibility: <Reviewer2> -- Feature Logic: <Logic design> -- <Any other context mention here> OR -- <Component 1>: <Reviewer1> -- <CosmosDB>: <Reviewer2> -- <ServiceBus> <Reviewer3> -- <Mention any other component and owner>
Other information
Edited by Vibhuti Sharma [Microsoft]