Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6093

create a slf4j-simple provider extension that supports level color rendering

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.5.0-alpha-1, 3.5.0
    • Component/s: Logging
    • Labels:
      None

      Description

      With color support, core Maven and plugins do general message colorization (or more high-level "message styling" through maven-shared-utils)
      slf4j provider however has to add color:

      • for log level output (DEBUG/INFO/WARNING/ERROR)
      • for stacktrace rendering

      That's why we use Gossip slf4j provider: it has sufficient little extension points to add this, with just a little bit of code (see http://maven.apache.org/ref/3-LATEST/maven-embedder/apidocs/org/apache/maven/cli/logging/impl/gossip/package-summary.html ) and configuration

      The issue with switching to Gossip slf4j provider is that people don't know it and it does not have the same features as slf4j-simple (missing relative timestamps and configuration with CLI: see http://mail-archives.apache.org/mod_mbox/maven-dev/201607.mbox/%3CCAK8jvqxYNK4weM2Frp4Brg3J7EybyjBiCsSRdGuNMQhYAG728Q%40mail.gmail.com%3E ), the configuration file is not the same (name nor content).
      But the extension points are not that big: if slf4j-simple provider just made a few methods protected instread of private, it would be extensible

      What if we just copy slf4j-simple to change the signatures and create small extension classes? The license permits it, we can try it and eventually see with slf4j if the modification can go into official release

        Issue Links

          Activity

          Hide
          hboutemy Hervé Boutemy added a comment -

          proof of concept implemented in http://git-wip-us.apache.org/repos/asf/maven/commit/6d8d0e1d

          in fact, I added 2 rendering methods in SimpleLogger to implement them in an extension: IMHO, this could be an interface slf4j-simple with a default implementation and a configurable override...

          I don't know precisely what NOTICE has to be added, since it contains a copy of some slf4j code
          and I don't know if it is really the way to go, but at least, "it works" for now as a POC

          Show
          hboutemy Hervé Boutemy added a comment - proof of concept implemented in http://git-wip-us.apache.org/repos/asf/maven/commit/6d8d0e1d in fact, I added 2 rendering methods in SimpleLogger to implement them in an extension: IMHO, this could be an interface slf4j-simple with a default implementation and a configurable override... I don't know precisely what NOTICE has to be added, since it contains a copy of some slf4j code and I don't know if it is really the way to go, but at least, "it works" for now as a POC
          Hide
          hboutemy Hervé Boutemy added a comment - - edited

          work finalized in http://git-wip-us.apache.org/repos/asf/maven/commit/bf44e8a0 : now, there is a monkey-patch as a Groovy script

          now need to see if this is what we want

          Show
          hboutemy Hervé Boutemy added a comment - - edited work finalized in http://git-wip-us.apache.org/repos/asf/maven/commit/bf44e8a0 : now, there is a monkey-patch as a Groovy script now need to see if this is what we want
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-3.x #1402 (See https://builds.apache.org/job/maven-3.x/1402/)
          MNG-6093 switched to monkey patched slf4j-simple provider supporting (hboutemy: rev 5bd5a6df8d2664e9c13941a85e0bccd58958f7ce)

          • (add) maven-slf4j-provider/src/main/script/patch-slf4j-simple.groovy
          • (add) maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLogger.java
          • (edit) pom.xml
          • (add) maven-slf4j-provider/src/site/site.xml
          • (edit) maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties
          • (edit) src/site/xdoc/index.xml
          • (edit) apache-maven/pom.xml
          • (add) maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLoggerFactory.java
          • (add) maven-slf4j-provider/pom.xml
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1402 (See https://builds.apache.org/job/maven-3.x/1402/ ) MNG-6093 switched to monkey patched slf4j-simple provider supporting (hboutemy: rev 5bd5a6df8d2664e9c13941a85e0bccd58958f7ce) (add) maven-slf4j-provider/src/main/script/patch-slf4j-simple.groovy (add) maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLogger.java (edit) pom.xml (add) maven-slf4j-provider/src/site/site.xml (edit) maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties (edit) src/site/xdoc/index.xml (edit) apache-maven/pom.xml (add) maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLoggerFactory.java (add) maven-slf4j-provider/pom.xml
          Hide
          stephenc Stephen Connolly added a comment -

          Maven 3.4.0 has been dropped. See this thread for more details.

          This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.

          Show
          stephenc Stephen Connolly added a comment - Maven 3.4.0 has been dropped. See this thread for more details. This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.

            People

            • Assignee:
              hboutemy Hervé Boutemy
              Reporter:
              hboutemy Hervé Boutemy
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development