Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5114

Using different logging implementations instead of facade

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Must
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Platform 2.1.2, Core 2.2.0
    • Component/s: None
    • Labels:
      None
    • Complexity:
      Low

      Description

      In the root pom we exclude the apache commons-logging dependency coming from springframework. I assume this is because we want to use the logging facade https://www.slf4j.org/ that we import which in turn delegates to the log4j as the logging implementation that we include in the root pom. This all seems like we try to use springs approach documented here http://docs.spring.io/spring/docs/4.1.4.RELEASE/spring-framework-reference/htmlsingle/#overview-not-using-commons-logging

      But if you search in the code for apache.commons.logging you find quite a bit of classes that depend on it. For example ConceptReferenceTermEditor; there are many more.

      Solution:

      • replace all occurrences of the apache.commons.logging with slf4j
      • slf4j does not support the log level FATAL, and suggests to use markers to log it the event as error instead and mark it with "FATAL" see https://www.slf4j.org/faq.html#fatal

      NOTE: This does not change the behavior of the OpenmrsUtil which sets the log level since this part of the code uses the log4j API directly to set levels. From the user perspective this is not changed.

      It does however mean that developers of core and modules cannot log to log level FATAL if we do not want to be coupled to log4j or any other logging implementation.

      TODO: we should also eliminate the apache.commons.logging dependency that seems to slip in somewhere by another dependency. I do not know where. mvn dependency:tree doesnt show anything related to

        Gliffy Diagrams

          Attachments

            Issue Links

              Attachments-Category-Modification

                Activity

                  People

                  • Assignee:
                    teleivo Ivo Ulrich
                    Reporter:
                    teleivo Ivo Ulrich
                  • Votes:
                    0 Vote for this issue
                    Watchers:
                    4 Start watching this issue

                    Dates

                    • Created:
                      Updated:
                      Resolved: