Skip to content

Adding logging using slf4j and mdc context

Vibhuti Sharma [Microsoft] requested to merge users/Vibhuti/enable-logging into master

All Submissions:


  • [YES] I have added an explanation of what changes in this merge do and why we should include it?
  • [YES] 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:

  • Using org.slf4j instead of java.util.logging for logging
  • MDC context is also added, to be able to log correlation-id and data-partition-id in every log message.

Issue:

  • Currently logging in indexer-worker happens using java.util.logging library. We want to use slf4j-log4j2 logging as the standard logging across all services. This MR updates the same.

Change details:

  • In other R2 services, SLF4JLogger and MDCFilter are used from the core-lib-azure library in order to perform logging. However, in indexer-worker, the same classes cannot be used as few variables in these classes require a request-response model, and hence null pointer exceptions and other errors are encountered when we try to use these classes. So we are directly using org.slf4j and org.MDC here.
  • Log4j2 appender is added to integrate with application insights
  • App insights key is added to deployment.yaml

Test coverage:


N/A

Does this introduce a breaking change?


  • [NO]

Pending items


N/A

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]

Merge request reports