title: How to redirect AWS sdk logging output
body: <p>I keep getting those on STDOUT even though I'm using logback and configured it. I'm not able to get AWS stuff out of the console.</p>
  
  <pre><code>Jun 19, 2014 3:46:40 PM com.amazonaws.http.AmazonHttpClient executeHelper
  INFO: Unable to execute HTTP request: The target server failed to respond
  org.apache.http.NoHttpResponseException: The target server failed to respond
          at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:95)
          at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62)
          at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
          at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
          at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)  
          at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)   
          at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
          at com.amazonaws.http.protocol.SdkHttpRequestExecutor.doReceiveResponse(SdkHttpRequestExecutor.java:66)
          at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
          at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:713)
          at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:518)
          at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
          at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
          at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:402)
          at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:245)
          at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3573)
          at com.amazonaws.services.s3.AmazonS3Client.getObjectMetadata(AmazonS3Client.java:990)
          at com.amazonaws.services.s3.AmazonS3Client.getObjectMetadata(AmazonS3Client.java:970)
          at com.here.prime.cdtfilter.S3MapStore$$anonfun$1.apply(S3MapStore.scala:49)
          at com.here.prime.cdtfilter.S3MapStore$$anonfun$1.apply(S3MapStore.scala:48)
          at com.here.prime.utils.Utils$.retry(Utils.scala:26)
  </code></pre>
  
  <p>This is my logback configuration:</p>
  
  <pre><code>&lt;configuration debug="false" scan="true" scanPeriod="30 seconds"&gt;
      &lt;appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"&gt;
          &lt;encoder&gt;
              &lt;pattern&gt;%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n&lt;/pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
  
      &lt;appender name="FILE" class="ch.qos.logback.core.FileAppender"&gt;
          &lt;file&gt;cdtxfilter.log&lt;/file&gt;
          &lt;append&gt;true&lt;/append&gt;
          &lt;encoder&gt;
              &lt;pattern&gt;%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n&lt;/pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
  
      &lt;logger name="com.amazonaws.request" level="WARN"&gt;
      &lt;/logger&gt;
  
      &lt;root level="DEBUG"&gt;
          &lt;!--&lt;appender-ref ref="STDOUT" /&gt;--&gt;
          &lt;appender-ref ref="FILE" /&gt;
      &lt;/root&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <hr>
  
  <p>Solution:</p>
  
  <p>Force logging through logback, instead of commons-logging:</p>
  
  <p>In build.sbt added:</p>
  
  <pre><code>resolvers ++= Seq(
    "version99 Empty loggers" at "http://version99.qos.ch",
  )
  
  libraryDependencies ++= Seq(
    "org.slf4j" % "jcl-over-slf4j" % "1.7.7",
    "commons-logging" % "commons-logging" % "99-empty",
    "ch.qos.logback" % "logback-classic" % "1.0.13",
  )
  </code></pre>
  
  <p>In logback.xml, fine tune the log level for the noisy classes inside AWS SDK:</p>
  
  <pre><code>&lt;configuration...
  [..]
      &lt;logger name="com.amazonaws" level="ERROR"/&gt;
      &lt;logger name="org.apache.http" level="INFO" /&gt;
  &lt;/configuration&gt;
  </code></pre>