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

HttpClient produces a lot of noise at debug loglevel

    Details

      Description

      Empty your repository and run mvn compile -X on any project.
      You'll see all headers and the content (either as text or bytes) and more for every downloaded file by Wagon, making the loggin useless.

        Activity

        Hide
        michael-o Michael Osipov added a comment -

        This is not a bug, but rather a result of several previous issues. Apache HttpComponents unfortunately still uses Commons Logging (HTTPCLIENT-1664). As you might now, Wagon HTTP Provider is added as a shaded JAR to Maven distribution. Up until WAGON-471 Commons Logging was shaded, but had no effect because it could not log anywhere. Now JCL over SLF4J is used and HttpComponents can log just like every other dependency. Since -X enables debug on all loggers, you see the entire HTTP comm as well. So the issue existed eversince, but simply was not visible. In short-term you can explicitly disable logging on HttpComponents in org.apache.maven.cli.logging.impl.*, in the long-term you'd require every single logging component to register its logger name. Consider that the former option likely takes away the possibility to enable debug logging with HttpComponents to trace errors.

        Show
        michael-o Michael Osipov added a comment - This is not a bug, but rather a result of several previous issues. Apache HttpComponents unfortunately still uses Commons Logging ( HTTPCLIENT-1664 ). As you might now, Wagon HTTP Provider is added as a shaded JAR to Maven distribution. Up until WAGON-471 Commons Logging was shaded, but had no effect because it could not log anywhere. Now JCL over SLF4J is used and HttpComponents can log just like every other dependency. Since -X enables debug on all loggers, you see the entire HTTP comm as well. So the issue existed eversince, but simply was not visible. In short-term you can explicitly disable logging on HttpComponents in org.apache.maven.cli.logging.impl.* , in the long-term you'd require every single logging component to register its logger name. Consider that the former option likely takes away the possibility to enable debug logging with HttpComponents to trace errors.
        Hide
        rfscholte Robert Scholte added a comment -

        The bug is more about the huge amount af logging produced, which simply makes debug logging useless. We should provide a better logging configuration.

        I'd hoped we could define this by default, like

        /conf/logging/
        org.slf4j.simpleLogger.log.org.apache.http=error
        org.slf4j.simpleLogger.log.org.apache.http.wire=error
        

        but somehow this isn't picked up, don't understand why yet.

        Show
        rfscholte Robert Scholte added a comment - The bug is more about the huge amount af logging produced, which simply makes debug logging useless. We should provide a better logging configuration. I'd hoped we could define this by default, like /conf/logging/ org.slf4j.simpleLogger.log.org.apache.http=error org.slf4j.simpleLogger.log.org.apache.http.wire=error but somehow this isn't picked up, don't understand why yet.
        Hide
        michael-o Michael Osipov added a comment -

        You forgot that HttpComponents are shaded into HTTP provider. Use this:

        org.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient=warn
        

        Shading rule:

        <relocation>
          <pattern>org.apache.http</pattern>
          <shadedPattern>org.apache.maven.wagon.providers.http.httpclient</shadedPattern>
        </relocation>
        
        Show
        michael-o Michael Osipov added a comment - You forgot that HttpComponents are shaded into HTTP provider. Use this: org.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient=warn Shading rule: <relocation> <pattern> org.apache.http </pattern> <shadedPattern> org.apache.maven.wagon.providers.http.httpclient </shadedPattern> </relocation>
        Hide
        rfscholte Robert Scholte added a comment -

        I've added a couple of lines to the simplelogger.properties to restore logging behavior. All these properties can be adjusted via commandline: -Dorg.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient=debug will make it log at debug level again.

        Show
        rfscholte Robert Scholte added a comment - I've added a couple of lines to the simplelogger.properties to restore logging behavior. All these properties can be adjusted via commandline: -Dorg.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient=debug will make it log at debug level again.
        Hide
        michael-o Michael Osipov added a comment - - edited

        You completely disabled it now. Why not warn/info at least?

        Show
        michael-o Michael Osipov added a comment - - edited You completely disabled it now. Why not warn/info at least?
        Hide
        rfscholte Robert Scholte added a comment -

        IIUC it has never worked, so this will restore the original behavior. I also expect that the logging by Wagon is good enough if there are issues. I just want to prevent an overload of logging. Logging == IO == slow and in case of analyses we have the option to adjust the levels.

        Show
        rfscholte Robert Scholte added a comment - IIUC it has never worked, so this will restore the original behavior. I also expect that the logging by Wagon is good enough if there are issues. I just want to prevent an overload of logging. Logging == IO == slow and in case of analyses we have the option to adjust the levels.
        Hide
        michael-o Michael Osipov added a comment -

        OK, makes sense. Can we document this somewhere for people?

        Show
        michael-o Michael Osipov added a comment - OK, makes sense. Can we document this somewhere for people?
        Show
        rfscholte Robert Scholte added a comment - http://maven.apache.org/maven-logging.html
        Hide
        michael-o Michael Osipov added a comment -

        This is indeed sufficient.

        Show
        michael-o Michael Osipov added a comment - This is indeed sufficient.
        Hide
        rfscholte Robert Scholte added a comment -
        Show
        rfscholte Robert Scholte added a comment - Fixed in e0da20a1f801aeda0cd74495834c637c3a207478
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build maven-3.x #1558 (See https://builds.apache.org/job/maven-3.x/1558/)
        MNG-6181 HttpClient produces a lot of noise at debug loglevel (rfscholte: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=e0da20a1f801aeda0cd74495834c637c3a207478)

        • (edit) apache-maven/src/conf/logging/simplelogger.properties
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1558 (See https://builds.apache.org/job/maven-3.x/1558/ ) MNG-6181 HttpClient produces a lot of noise at debug loglevel (rfscholte: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=e0da20a1f801aeda0cd74495834c637c3a207478 ) (edit) apache-maven/src/conf/logging/simplelogger.properties

          People

          • Assignee:
            rfscholte Robert Scholte
            Reporter:
            rfscholte Robert Scholte
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development