Disable INFO logging from AWS Java SDK

Posted on 2011-06-22

We're using the AWS Java SDK and had an incredibly difficult time figuring out how to disable INFO-level logging. This is probably particular to our configuration, but I think it is a fairly common setup: Jetty on Ubuntu on EC2. The problem is that Jetty uses SLF4J, and includes the default slf4j-simple.jar which logs everything. In order to fix it, you have to remove the symlink in /usr/share/jetty/lib/jsp2.1 and create a new symlink to slf4j-jdk14.jar (and the configure java logging to not log at INFO). Step by step:
  1. cd /usr/share/jetty/lib/jsp2.1
  2. sudo rm slf4j-simple.jar
  3. sudo ln -s ../../../java/slf4j-jdk14.jar slf4j-jdk14.jar
  4. create /usr/share/jetty/webapps/root/WEB-INF/logging.properties with
    .level=WARNING
  5. cd /etc/defaults
  6. edit jetty and add:
    JAVA_OPTIONS=-Djava.util.logging.config.file=/usr/share/jetty/webapps/root/WEB-INF/logging.properties

Update (2014-09-16)

The above did not work with Jetty9 on Ubuntu 14.04 (Trusty Tahir). Instead add the following to /etc/default/jetty9:

  JAVA_OPTIONS="$JAVA_OPTIONS -Dorg.apache.commons.logging.simplelog.defaultlog=warn"

Tags: aws jetty logging ubuntu