[OODT-980] slf4j logging improvements and file manager CLI improvements for closing client
diff --git a/filemgr/pom.xml b/filemgr/pom.xml
index 9718319..ccf610f 100644
--- a/filemgr/pom.xml
+++ b/filemgr/pom.xml
@@ -96,10 +96,6 @@
       <artifactId>commons-io</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-pool</groupId>
       <artifactId>commons-pool</artifactId>
     </dependency>
@@ -210,6 +206,20 @@
       <groupId>xmlrpc</groupId>
       <artifactId>xmlrpc</artifactId>
     </dependency>
+
+    <!-- Logging -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jul-to-slf4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+    </dependency>
   </dependencies>
   <build>
     <directory>target</directory>
@@ -297,6 +307,10 @@
               <name>java.util.logging.config.file</name>
               <value>src/test/resources/test.logging.properties</value>
             </property>
+            <property>
+              <name>log4j.configurationFile</name>
+              <value>src/main/resources/log4j2.xml</value>
+            </property>
           </systemProperties>
           <environmentVariables>
             <FILEMGR_HOME>${project.basedir}</FILEMGR_HOME>
diff --git a/filemgr/src/main/assembly/assembly.xml b/filemgr/src/main/assembly/assembly.xml
index 2e90515..9f8d2ad 100644
--- a/filemgr/src/main/assembly/assembly.xml
+++ b/filemgr/src/main/assembly/assembly.xml
@@ -55,7 +55,7 @@
       <includes>
         <include>filemgr.properties</include>
         <include>logging.properties</include>
-        <include>log4j.xml</include>
+        <include>log4j2.xml</include>
       </includes>
     </fileSet>
     <fileSet>
diff --git a/filemgr/src/main/bin/filemgr b/filemgr/src/main/bin/filemgr
index 9e5ffde..1a8c416 100644
--- a/filemgr/src/main/bin/filemgr
+++ b/filemgr/src/main/bin/filemgr
@@ -52,8 +52,6 @@
      LIB_DEPS="${file}:${LIB_DEPS}"
 done
 
-LIB_DEPS="${FILEMGR_HOME}/etc/log4j.xml:${LIB_DEPS}"
-
 if [ ! -z $OODT_DISTRIBUTED_CONF ]
     then
     if [ ! -z $ZK_CONNECT_STRING ]
@@ -75,7 +73,7 @@
         $JAVA_HOME/bin/java \
         	-cp ${LIB_DEPS} \
         	${DISTRIBUTED_CONF_PROPERTIES} \
-        	-Dlog4j.configuration=log4j.xml \
+        	-Dlog4j.configurationFile=${FILEMGR_HOME}/etc/log4j2.xml \
         	-Djava.util.logging.config.file=${FILEMGR_HOME}/etc/logging.properties \
     	    -Dorg.apache.oodt.cas.filemgr.properties=${CAS_FILEMGR_PROPS} \
         	org.apache.oodt.cas.filemgr.system.FileManagerServerMain \
diff --git a/filemgr/src/main/bin/filemgr-client b/filemgr/src/main/bin/filemgr-client
index 20f2166..f2daf8f 100644
--- a/filemgr/src/main/bin/filemgr-client
+++ b/filemgr/src/main/bin/filemgr-client
@@ -30,6 +30,7 @@
 
 $JAVA_HOME/bin/java \
 	-cp ${LIB_DEPS} \
+	-Dlog4j.configurationFile=../etc/log4j2.xml \
 	-Dorg.apache.oodt.cas.filemgr.properties=../etc/filemgr.properties \
 	-Djava.util.logging.config.file=../etc/logging.properties \
 	-Dorg.apache.oodt.cas.cli.action.spring.config=../policy/cmd-line-actions.xml \
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java
index 26a8cee..437deaa 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java
@@ -36,6 +36,7 @@
 import org.apache.solr.schema.FieldType;
 import org.safehaus.uuid.UUID;
 import org.safehaus.uuid.UUIDGenerator;
+import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.IOException;
@@ -62,6 +63,13 @@
  * 
  */
 public class LuceneCatalog implements Catalog {
+
+    /* our log stream */
+    @Deprecated
+    private static final Logger LOG = Logger.getLogger(LuceneCatalog.class.getName());
+
+    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(LuceneCatalog.class);
+
     Directory indexDir = null;
 
     private DirectoryReader reader;
@@ -80,9 +88,6 @@
     /* our product ID generator */
     private static UUIDGenerator generator = UUIDGenerator.getInstance();
 
-    /* our log stream */
-    private static final Logger LOG = Logger.getLogger(LuceneCatalog.class.getName());
-
     /* page size for pagination */
     private int pageSize = -1;
 
@@ -836,6 +841,7 @@
      * @see org.apache.oodt.cas.filemgr.util.Pagination#getFirstPage(org.apache.oodt.cas.filemgr.structs.ProductType)
      */
     public ProductPage getFirstPage(ProductType type) {
+        logger.debug("Getting first page for product type: {}", type);
         ProductPage firstPage = new ProductPage();
         List<Product> products;
         Query query = new Query();
@@ -850,15 +856,19 @@
                     "CatalogException getting first page for product type: ["
                             + type.getProductTypeId()
                             + "] from catalog: Message: " + e.getMessage());
+            logger.error("Unable to get first page for product type: {} - {}", type, e.getMessage());
             return null;
         }
         // There are no products and thus no first page
         if (products == null || (products.size() == 0)) {
-        		return null;
+            logger.warn("No product found for first page for product type: {}", type);
+            return null;
         }
 
         firstPage.setPageProducts(products);
 
+        logger.debug("Found first page with products: {}", firstPage.getPageProducts());
+
         return firstPage;
     }
 
@@ -1364,11 +1374,13 @@
         if (pageNum == -1) {
             doSkip = false;
         }
+
         try {
             reader = DirectoryReader.open(indexDir);
         } catch (IOException e) {
-            e.printStackTrace();
+            logger.error("Error when creating directory reader, indexDir: {}, error: {}", indexDir, e.getMessage());
         }
+
         try {
             searcher = new IndexSearcher(reader);
 
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractDeleteProductCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractDeleteProductCliAction.java
index 30a0aa9..e3abde0 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractDeleteProductCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractDeleteProductCliAction.java
@@ -32,15 +32,13 @@
  * 
  * @author bfoster (Brian Foster)
  */
-public abstract class AbstractDeleteProductCliAction extends
-      FileManagerCliAction {
+public abstract class AbstractDeleteProductCliAction extends FileManagerCliAction {
 
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
       Product p = null;
-      try {
-         FileManagerClient client = getClient();
+      try (FileManagerClient client = getClient()) {
          p = getProductToDelete();
          List<Reference> refs = client.getProductReferences(p);
          if (refs == null) {
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractQueryCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractQueryCliAction.java
index 9310bc9..b5d09e5 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractQueryCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractQueryCliAction.java
@@ -29,6 +29,7 @@
 import org.apache.oodt.cas.filemgr.structs.query.QueryResult;
 import org.apache.oodt.cas.filemgr.structs.query.conv.VersionConverter;
 import org.apache.oodt.cas.filemgr.structs.query.filter.FilterAlgor;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 
 /**
  * Abstract query {@link CmdLineAction}.
@@ -54,7 +55,7 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
+      try (FileManagerClient client = getClient()) {
          ComplexQuery complexQuery = getQuery();
          complexQuery.setSortByMetKey(sortBy);
          complexQuery.setToStringResultFormat(outputFormat);
@@ -72,7 +73,8 @@
             }
             complexQuery.setQueryFilter(filter);
          }
-         List<QueryResult> results = getClient().complexQuery(complexQuery);
+
+         List<QueryResult> results = client.complexQuery(complexQuery);
          StringBuilder returnString = new StringBuilder("");
          for (QueryResult qr : results) {
             returnString.append(qr.toString()).append(delimiter);
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AddProductTypeCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AddProductTypeCliAction.java
index ec00eac..a816d79 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AddProductTypeCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AddProductTypeCliAction.java
@@ -22,6 +22,7 @@
 //OODT imports
 import org.apache.oodt.cas.cli.exception.CmdLineActionException;
 import org.apache.oodt.cas.filemgr.structs.ProductType;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 
 /**
  * A {@link CmdLineAction} which adds a {@link ProductType} to the file manager.
@@ -38,9 +39,8 @@
    private String versioner;
 
    @Override
-   public void execute(ActionMessagePrinter printer)
-         throws CmdLineActionException {
-      try {
+   public void execute(ActionMessagePrinter printer) throws CmdLineActionException {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(productTypeId, "Must specify productTypeId");
          Validate.notNull(productTypeName, "Must specify productTypeName");
          Validate.notNull(productTypeDescription,
@@ -56,8 +56,7 @@
          type.setProductRepositoryPath(fileRepositoryPath);
          type.setVersioner(versioner);
 
-         printer.println("addProductType: Result: "
-               + getClient().addProductType(type));
+         printer.println("addProductType: Result: " + client.addProductType(type));
       } catch (Exception e) {
          throw new CmdLineActionException("Failed to add product type with "
                + "id '" + productTypeId + "', name '" + productTypeName + "', description '"
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByIdCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByIdCliAction.java
index 03eb54e..2992cdc 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByIdCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByIdCliAction.java
@@ -16,8 +16,6 @@
  */
 package org.apache.oodt.cas.filemgr.cli.action;
 
-//Apache imports
-
 import org.apache.commons.lang.Validate;
 import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
@@ -27,8 +25,6 @@
 import java.io.IOException;
 import java.net.MalformedURLException;
 
-//OODT imports
-
 /**
  * A {@link CmdLineAction} which deletes a {@link Product} by ID.
  * 
@@ -42,13 +38,15 @@
    public Product getProductToDelete() throws CatalogException, ConnectionException, MalformedURLException {
       Validate.notNull(productId, "Must specify productId");
 
-      FileManagerClient client = getClient();
-      Product p = client.getProductById(productId);
-      if (p == null) {
-         throw new CatalogException("FileManager returned null for product '"
-               + productId + "'");
+      try (FileManagerClient client = getClient()) {
+         Product p = client.getProductById(productId);
+         if (p == null) {
+            throw new CatalogException("FileManager returned null for product '" + productId + "'");
+         }
+         return p;
+      } catch (IOException e) {
+         throw new CatalogException("Error occurred when fetching product: " + e.getMessage());
       }
-      return p;
    }
 
    public void setProductId(String productId) {
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
index c911430..bb683bb 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
@@ -24,7 +24,9 @@
 import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
 import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 
+import java.io.IOException;
 import java.net.MalformedURLException;
 
 /**
@@ -32,8 +34,7 @@
  * 
  * @author bfoster (Brian Foster)
  */
-public class DeleteProductByNameCliAction extends
-      AbstractDeleteProductCliAction {
+public class DeleteProductByNameCliAction extends AbstractDeleteProductCliAction {
 
    private String productName;
 
@@ -41,13 +42,16 @@
    protected Product getProductToDelete()
        throws CmdLineActionException, MalformedURLException, ConnectionException, CatalogException {
       Validate.notNull(productName, "Must specify productName");
-
-      Product p = getClient().getProductByName(productName);
-      if (p == null) {
-         throw new CmdLineActionException(
-               "FileManager returned null for product '" + productName + "'");
+      try (FileManagerClient client = getClient()) {
+         Product p = client.getProductByName(productName);
+         if (p == null) {
+            throw new CmdLineActionException(
+                    "FileManager returned null for product '" + productName + "'");
+         }
+         return p;
+      } catch (IOException e) {
+         throw new ConnectionException("Unable to get product by name: " + productName + " : " + e.getMessage());
       }
-      return p;
    }
 
    public void setProductName(String productName) {
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DumpMetadataCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DumpMetadataCliAction.java
index 4fb835a..28bb2a0 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DumpMetadataCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DumpMetadataCliAction.java
@@ -31,6 +31,7 @@
 //OODT imports
 import org.apache.oodt.cas.cli.exception.CmdLineActionException;
 import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.metadata.SerializableMetadata;
 import org.apache.oodt.commons.xml.XMLUtils;
@@ -48,14 +49,14 @@
    @Override
    public void execute(final ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(productId, "Must specify productId");
 
-         Product product = getClient().getProductById(productId);
+         Product product = client.getProductById(productId);
          if (product == null) {
             throw new Exception("FileManager returned null product");
          }
-         Metadata metadata = getClient().getMetadata(product);
+         Metadata metadata = client.getMetadata(product);
          if (metadata == null) {
             throw new Exception("FileManager returned null metadata");
          }
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/FileManagerCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/FileManagerCliAction.java
index 8630e3d..29496cd 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/FileManagerCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/FileManagerCliAction.java
@@ -16,7 +16,6 @@
  */
 package org.apache.oodt.cas.filemgr.cli.action;
 
-//JDK imports
 
 import org.apache.commons.lang.Validate;
 import org.apache.oodt.cas.cli.action.CmdLineAction;
@@ -24,13 +23,9 @@
 import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory;
 
-import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 
-//Apache imports
-//OODT imports
-
 /**
  * Base {@link CmdLineAction} for File Manager.
  *
@@ -38,30 +33,30 @@
  */
 public abstract class FileManagerCliAction extends CmdLineAction {
 
-   private FileManagerClient client;
+    private FileManagerClient fmc;
 
-   public String getUrl() {
-      return System.getProperty("org.apache.oodt.cas.filemgr.url");
-   }
+    public String getUrl() {
+        return System.getProperty("org.apache.oodt.cas.filemgr.url");
+    }
 
-   protected FileManagerClient getClient() throws MalformedURLException, ConnectionException {
-      Validate.notNull(getUrl(), "Must specify url");
+    /**
+     * TODO(imesha) Fix client closing problem which makes it usable only once
+     *
+     * @return client
+     * @throws MalformedURLException
+     * @throws ConnectionException
+     */
+    protected FileManagerClient getClient() throws MalformedURLException, ConnectionException {
+        Validate.notNull(getUrl(), "Must specify url");
 
-      if (client != null) {
-         return client;
-      } else {
-         return RpcCommunicationFactory.createClient(new URL(getUrl()), false);
-      }
-   }
+        if (this.fmc != null) {
+            return fmc;
+        }
 
-   public void setClient(FileManagerClient client) {
-      this.client = client;
-   }
+        return RpcCommunicationFactory.createClient(new URL(getUrl()), false);
+    }
 
-   @Override
-   public void finalize() throws IOException {
-      if (client != null) {
-         client.close();
-      }
-   }
+    public void setClient(FileManagerClient client) {
+        this.fmc = client;
+    }
 }
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetCurrentTransferCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetCurrentTransferCliAction.java
index a6bfc48..7071378 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetCurrentTransferCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetCurrentTransferCliAction.java
@@ -19,6 +19,7 @@
 //OODT imports
 import org.apache.oodt.cas.cli.exception.CmdLineActionException;
 import org.apache.oodt.cas.filemgr.structs.FileTransferStatus;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 
 /**
  * A {@link CmdLineAction} which get the current {@link Product} file transfer.
@@ -30,8 +31,8 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
-         FileTransferStatus status = getClient().getCurrentFileTransfer();
+      try (FileManagerClient client = getClient()) {
+         FileTransferStatus status = client.getCurrentFileTransfer();
          if (status == null) {
             throw new NullPointerException(
                   "FileManager returned null transfer status");
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetCurrentTransfersCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetCurrentTransfersCliAction.java
index 9e1ef7b..3b30ab9 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetCurrentTransfersCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetCurrentTransfersCliAction.java
@@ -22,6 +22,7 @@
 //OODT imports
 import org.apache.oodt.cas.cli.exception.CmdLineActionException;
 import org.apache.oodt.cas.filemgr.structs.FileTransferStatus;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 
 /**
  * A {@link CmdLineAction} which get list of current {@link Product} file
@@ -34,9 +35,8 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
-         List<FileTransferStatus> statuses = getClient()
-               .getCurrentFileTransfers();
+      try (FileManagerClient client = getClient()) {
+         List<FileTransferStatus> statuses = client.getCurrentFileTransfers();
          if (statuses == null) {
             throw new NullPointerException(
                   "FileManager returned null file transfers");
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetFilePercentTransferredCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetFilePercentTransferredCliAction.java
index 111e3ac..5045324 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetFilePercentTransferredCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetFilePercentTransferredCliAction.java
@@ -26,6 +26,7 @@
 //OODT imports
 import org.apache.oodt.cas.cli.exception.CmdLineActionException;
 import org.apache.oodt.cas.filemgr.structs.Reference;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 
 /**
  * A {@link CmdLineAction} which get percent transferred for a given data file.
@@ -39,14 +40,13 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(origRef, "Must specify origRef");
 
          Reference ref = new Reference();
          ref.setOrigReference(getUri(origRef).toString());
 
-         printer.println("Reference: [origRef=" + origRef + ",transferPct="
-               + getClient().getRefPctTransferred(ref) + "]");
+         printer.println("Reference: [origRef=" + origRef + ",transferPct=" + client.getRefPctTransferred(ref) + "]");
       } catch (Exception e) {
          throw new CmdLineActionException(
                "Failed to get percent transfered for" + " file '" + origRef
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetFirstPageCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetFirstPageCliAction.java
index ca2292a..50a470b 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetFirstPageCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetFirstPageCliAction.java
@@ -17,15 +17,16 @@
 package org.apache.oodt.cas.filemgr.cli.action;
 
 //Apache imports
-import org.apache.commons.lang.Validate;
 
-//OODT imports
+import org.apache.commons.lang.Validate;
 import org.apache.oodt.cas.cli.exception.CmdLineActionException;
 import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.structs.ProductPage;
 import org.apache.oodt.cas.filemgr.structs.ProductType;
 import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 
+//OODT imports
+
 /**
  * A {@link CmdLineAction} which gets the first page of {@link Product}s of a
  * given {@link ProductType}.
@@ -37,12 +38,10 @@
    private String productTypeName;
 
    @Override
-   public void execute(ActionMessagePrinter printer)
-         throws CmdLineActionException {
-      try {
+   public void execute(ActionMessagePrinter printer) throws CmdLineActionException {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(productTypeName, "Must specify productTypeName");
 
-         FileManagerClient client = getClient();
          ProductType type = client.getProductTypeByName(productTypeName);
          if (type == null) {
             throw new Exception("FileManager returned null ProductType");
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetLastPageCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetLastPageCliAction.java
index ed9bdd0..570e551 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetLastPageCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetLastPageCliAction.java
@@ -39,11 +39,9 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(productTypeName, "Must specify productTypeName");
 
-         FileManagerClient client = getClient();
-
          ProductType type = client.getProductTypeByName(productTypeName);
          if (type == null) {
             throw new Exception("FileManager returned null ProductType");
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetNextPageCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetNextPageCliAction.java
index f03f663..ec6c8ba 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetNextPageCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetNextPageCliAction.java
@@ -41,12 +41,10 @@
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
 
-      try {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(productTypeName, "Must specify productTypeName");
          Validate.isTrue(currentPageNum != -1, "Must specify currentPageNum");
 
-         FileManagerClient client = getClient();
-
          ProductType type = client.getProductTypeByName(productTypeName);
          if (type == null) {
             throw new Exception("FileManager returned null ProductType");
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetNumProductsCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetNumProductsCliAction.java
index 4dec6c3..42f8e79 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetNumProductsCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetNumProductsCliAction.java
@@ -37,10 +37,9 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(productTypeName, "Must specify productTypeName");
 
-         FileManagerClient client = getClient();
          ProductType pt = client.getProductTypeByName(productTypeName);
          if (pt == null) {
             throw new Exception("FileManager returned null ProductType");
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetPrevPageCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetPrevPageCliAction.java
index c4e778d..b72bdad 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetPrevPageCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetPrevPageCliAction.java
@@ -40,12 +40,10 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(productTypeName, "Must specify productTypeName");
          Validate.notNull(currentPageNum, "Must specify currentPageNum");
 
-         FileManagerClient client = getClient();
-
          ProductType type = client.getProductTypeByName(productTypeName);
          if (type == null) {
             throw new Exception("FileManager returned null ProductType");
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByIdCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByIdCliAction.java
index 20d0ba8..8f7a772 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByIdCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByIdCliAction.java
@@ -23,7 +23,9 @@
 import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
 import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 
+import java.io.IOException;
 import java.net.MalformedURLException;
 
 /**
@@ -40,12 +42,15 @@
    public Product getProduct() throws MalformedURLException, ConnectionException, CatalogException {
       Validate.notNull(productId, "Must specify productId");
 
-      Product p = getClient().getProductById(productId);
-      if (p == null) {
-         throw new CatalogException("FileManager returned null product for id '"
-               + productId + "'");
+      try(FileManagerClient client = getClient()) {
+         Product p = client.getProductById(productId);
+         if (p == null) {
+            throw new CatalogException("FileManager returned null product for id '" + productId + "'");
+         }
+         return p;
+      } catch (IOException e) {
+         throw new ConnectionException("Unable to get product by ID : " + productId + " : " + e.getMessage());
       }
-      return p;
    }
 
    public void setProductId(String productId) {
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByNameCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByNameCliAction.java
index 300643b..c070f91 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByNameCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductByNameCliAction.java
@@ -23,7 +23,9 @@
 import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
 import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 
+import java.io.IOException;
 import java.net.MalformedURLException;
 
 /**
@@ -40,12 +42,15 @@
    public Product getProduct() throws MalformedURLException, ConnectionException, CatalogException {
       Validate.notNull(productName, "Must specify productName");
 
-      Product p = getClient().getProductByName(productName);
-      if (p == null) {
-         throw new CatalogException("FileManager returned null product for name '"
-               + productName + "'");
+      try (FileManagerClient client = getClient()) {
+         Product p = client.getProductByName(productName);
+         if (p == null) {
+            throw new CatalogException("FileManager returned null product for name '" + productName + "'");
+         }
+         return p;
+      } catch (IOException e) {
+         throw new ConnectionException("Unable to get product by name: " + productName + " : " + e.getMessage());
       }
-      return p;
    }
 
    public void setProductName(String productName) {
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductPercentTransferredCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductPercentTransferredCliAction.java
index 6eb274a..d72ca6c 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductPercentTransferredCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductPercentTransferredCliAction.java
@@ -39,12 +39,10 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(productId, "Must specify productid");
          Validate.notNull(productTypeName, "Must specify productTypeName");
 
-         FileManagerClient client = getClient();
-
          Product product = new Product();
          // TODO(bfoster): Not sure why ProductType is needed here.
          ProductType pt = client.getProductTypeByName(productTypeName);
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductTypeByNameCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductTypeByNameCliAction.java
index dc0af3b..64428c1 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductTypeByNameCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/GetProductTypeByNameCliAction.java
@@ -22,6 +22,7 @@
 //OODT imports
 import org.apache.oodt.cas.cli.exception.CmdLineActionException;
 import org.apache.oodt.cas.filemgr.structs.ProductType;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 
 /**
  * A {@link org.apache.oodt.cas.cli.action.CmdLineAction} which gets a {@link ProductType} by name.
@@ -35,10 +36,10 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(productTypeName, "Must specify productTypeName");
 
-         ProductType type = getClient().getProductTypeByName(productTypeName);
+         ProductType type = client.getProductTypeByName(productTypeName);
          if (type == null) {
             throw new Exception("FileManager returned null ProductType");
          }
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/HasProductCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/HasProductCliAction.java
index 48c8ef2..5f7fbd3 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/HasProductCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/HasProductCliAction.java
@@ -21,6 +21,7 @@
 
 //OODT imports
 import org.apache.oodt.cas.cli.exception.CmdLineActionException;
+import org.apache.oodt.cas.filemgr.system.FileManagerClient;
 
 /**
  * A {@link CmdLineAction} which checks if the File Manager has a given
@@ -35,11 +36,10 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(productName, "Must specify productName");
 
-         printer.println("hasProduct: Result: "
-               + getClient().hasProduct(productName));
+         printer.println("hasProduct: Result: " + client.hasProduct(productName));
       } catch (Exception e) {
          throw new CmdLineActionException("Failed to check for product '"
                + productName + "' : " + e.getMessage(), e);
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java
index e0ec33e..b0290a2 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java
@@ -61,15 +61,13 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
+      try (FileManagerClient client = getClient()) {
          Validate.notNull(productName, "Must specify productName");
          Validate.notNull(productStructure, "Must specify productStructure");
          Validate.notNull(productTypeName, "Must specify productTypeName");
          Validate.notNull(metadataFile, "Must specify metadataFile");
          Validate.notNull(references, "Must specify references");
 
-         FileManagerClient client = getClient();
-
          ProductType pt = client.getProductTypeByName(productTypeName);
          if (pt == null) {
             throw new Exception("FileManager returned null ProductType");
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/RetrieveFilesCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/RetrieveFilesCliAction.java
index 2ff757d..e7e6269 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/RetrieveFilesCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/RetrieveFilesCliAction.java
@@ -41,19 +41,18 @@
    @Override
    public void execute(ActionMessagePrinter printer)
          throws CmdLineActionException {
-      try {
-         FileManagerClient fmClient = getClient();
-         dt.setFileManagerUrl(fmClient.getFileManagerUrl());
+      try (FileManagerClient client = getClient()) {
+         dt.setFileManagerUrl(client.getFileManagerUrl());
          Product product;
          if (productId != null) {
-            product = fmClient.getProductById(productId);
+            product = client.getProductById(productId);
          } else if (productName != null) {
-            product = fmClient.getProductByName(productName);
+            product = client.getProductByName(productName);
          } else {
               throw new Exception("Must specify either productId or productName");
          }
          if (product != null) {
-            product.setProductReferences(fmClient.getProductReferences(product));
+            product.setProductReferences(client.getProductReferences(product));
             dt.retrieveProduct(product, destination);
          } else {
             throw new Exception("Product was not found");
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java
index 0f86537..11c35a7 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java
@@ -28,6 +28,7 @@
 import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory;
 
 //JDK imports
+import java.io.IOException;
 import java.net.URL;
 import java.util.HashSet;
 import java.util.List;
@@ -308,4 +309,9 @@
         }
     }
 
+    public void finalize() throws IOException {
+        if (fm != null) {
+            fm.close();
+        }
+    }
 }
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
index ef79439..0b6b59f 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
@@ -24,6 +24,9 @@
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
@@ -33,10 +36,6 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
 /**
  * @author mattmann
  * @author bfoster
@@ -370,4 +369,9 @@
     public String getProductReceivedTime() {
         return productReceivedTime;
     }
+
+    @Override
+    public String toString() {
+        return String.format("%s[%s-%s]", this.getProductId(), this.getProductName(), this.getProductType().getName());
+    }
 }
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/ProductPage.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/ProductPage.java
index 2ed9312..84b3601 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/ProductPage.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/ProductPage.java
@@ -180,5 +180,9 @@
         blank.setPageProducts(Collections.EMPTY_LIST);
         return blank;
     }
-    
+
+    @Override
+    public String toString() {
+        return String.format("(Page %s -> %d Products)", pageNum, pageProducts.size());
+    }
 }
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/AvroFileManagerClient.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/AvroFileManagerClient.java
index 0b28bff..2057ce1 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/AvroFileManagerClient.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/AvroFileManagerClient.java
@@ -48,6 +48,8 @@
 import org.apache.oodt.cas.filemgr.util.GenericFileManagerObjectFactory;
 import org.apache.oodt.cas.filemgr.versioning.Versioner;
 import org.apache.oodt.cas.metadata.Metadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
@@ -55,8 +57,6 @@
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 /**
  * @author radu
@@ -65,8 +65,7 @@
  */
 public class AvroFileManagerClient implements FileManagerClient {
 
-    private static Logger LOG = Logger.getLogger(AvroFileManagerClient.class
-            .getName());
+    private static final Logger logger = LoggerFactory.getLogger(AvroFileManagerClient.class);
 
     /** Avro-Rpc client */
     private Transceiver client;
@@ -92,9 +91,7 @@
             this.client = new NettyTransceiver(inetSocketAddress, 40000L);
             proxy = (AvroFileManager) SpecificRequestor.getClient(AvroFileManager.class, client);
         } catch (IOException e) {
-            e.printStackTrace();
-            LOG.log(Level.WARNING, "IOException when connecting to filemgr: ["
-                    + this.fileManagerUrl + "]");
+            logger.error("Error occurred when creating file manager: {}", url, e);
         }
 
         if (testConnection && !isAlive()) {
@@ -109,9 +106,7 @@
         try {
             success = proxy.refreshConfigAndPolicy();
         } catch (AvroRemoteException e) {
-            LOG.log(Level.WARNING, "AvroRemoteException when connecting to filemgr: ["
-                    + this.fileManagerUrl + "]");
-            success = false;
+            logger.error("AvroRemoteException when connecting to filemgr: {}", fileManagerUrl, e);
         }
 
         return success;
@@ -126,8 +121,7 @@
                 success = proxy.isAlive();
             } else return false;
         } catch (AvroRemoteException e) {
-            LOG.log(Level.WARNING, "AvroRemoteException when connecting to filemgr: ["
-                    + this.fileManagerUrl + "]");
+            logger.error("Error when connecting to filemgr: {}", fileManagerUrl);
             success = false;
         }
 
@@ -258,15 +252,18 @@
 
     @Override
     public ProductPage getFirstPage(ProductType type) throws CatalogException {
+        logger.debug("Getting first page for product type: {}", type.toString());
         try {
             return AvroTypeFactory.getProductPage(this.proxy.getFirstPage(AvroTypeFactory.getAvroProductType(type)));
         } catch (AvroRemoteException e) {
-            throw new CatalogException(e.getMessage());
+            logger.error("Unable to get first page for product type: {}", type.toString(), e);
+            throw new CatalogException("Unable to get first page", e);
         }
     }
 
     @Override
     public ProductPage getLastPage(ProductType type) throws CatalogException {
+        logger.debug("Getting last page for product type: {}", type.toString());
         try {
             return AvroTypeFactory.getProductPage(this.proxy.getLastPage(AvroTypeFactory.getAvroProductType(type)));
         } catch (AvroRemoteException e) {
@@ -276,6 +273,7 @@
 
     @Override
     public ProductPage getNextPage(ProductType type, ProductPage currPage) throws CatalogException {
+        logger.debug("Getting next page for product type: {}, current page: {}", type.toString(), currPage.getPageNum());
         try {
             return AvroTypeFactory.getProductPage(this.proxy.getNextPage(
                     AvroTypeFactory.getAvroProductType(type),
@@ -288,6 +286,7 @@
 
     @Override
     public ProductPage getPrevPage(ProductType type, ProductPage currPage) throws CatalogException {
+        logger.debug("Getting previous page for product type: {}, current page: {}", type.toString(), currPage.getPageNum());
         try {
             return AvroTypeFactory.getProductPage(this.proxy.getPrevPage(
                     AvroTypeFactory.getAvroProductType(type),
@@ -300,6 +299,7 @@
 
     @Override
     public String addProductType(ProductType type) throws RepositoryManagerException {
+        logger.debug("Adding product type: {}", type.toString());
         try {
             return this.proxy.addProductType(AvroTypeFactory.getAvroProductType(type));
         } catch (AvroRemoteException e) {
@@ -582,8 +582,8 @@
     }
 
     @Override
-    public String ingestProduct(Product product, Metadata metadata,
-            boolean clientTransfer) throws Exception {
+    public String ingestProduct(Product product, Metadata metadata, boolean clientTransfer) throws Exception {
+        logger.debug("Ingesting product: {}", product.getProductName());
         try {
             // ingest product
             String productId = this.proxy.ingestProduct(
@@ -592,12 +592,12 @@
                     clientTransfer);
 
             if (clientTransfer) {
-                LOG.log(Level.FINEST, "File Manager Client: clientTransfer enabled: transfering product ["
-                        + product.getProductName() + "]");
+                logger.debug("clientTransfer enabled: transfering product: {}", product.getProductName());
 
                 // we need to transfer the product ourselves
                 // make sure we have the product ID
                 if (productId == null) {
+                    logger.error("Product ID is null for product: {}", product.getProductName());
                     throw new Exception("Request to ingest product: "
                             + product.getProductName()
                             + " but no product ID returned from File "
@@ -605,6 +605,7 @@
                 }
 
                 if (dataTransfer == null) {
+                    logger.warn("Data transferer is null. Product: {}", product.getProductName());
                     throw new Exception("Request to ingest product: ["
                             + product.getProductName()
                             + "] using client transfer, but no "
@@ -624,14 +625,8 @@
                     try {
                         addProductReferences(product);
                     } catch (CatalogException e) {
-                        LOG
-                                .log(
-                                        Level.SEVERE,
-                                        "ingestProduct: RepositoryManagerException "
-                                                + "when adding Product References for Product : "
-                                                + product.getProductName()
-                                                + " to RepositoryManager: Message: "
-                                                + e.getMessage());
+                        logger.error("Error when adding Product references for Product [{}] to repository manager: {}",
+                                product.getProductName(), e.getMessage());
                         throw e;
                     }
                 } else {
@@ -648,20 +643,13 @@
                     try {
                         setProductTransferStatus(product);
                     } catch (CatalogException e) {
-                        LOG
-                                .log(
-                                        Level.SEVERE,
-                                        "ingestProduct: RepositoryManagerException "
-                                                + "when updating product transfer status for Product: "
-                                                + product.getProductName()
-                                                + " Message: " + e.getMessage());
+                        logger.error("Error when updating product transfer status for Product[{}]: {}",
+                                product.getProductName(), e.getMessage());
                         throw e;
                     }
                 } catch (Exception e) {
-                    LOG.log(Level.SEVERE,
-                            "ingestProduct: DataTransferException when transfering Product: "
-                                    + product.getProductName() + ": Message: "
-                                    + e.getMessage());
+                    logger.error("DataTransferException when transferring Product[{}]: {}",
+                            product.getProductName(), e.getMessage());
                     throw new DataTransferException(e);
                 }
 
@@ -670,26 +658,18 @@
 
             // error versioning file
         } catch (VersioningException e) {
-            e.printStackTrace();
-            LOG.log(Level.SEVERE,
-                    "ingestProduct: VersioningException when versioning Product: "
-                            + product.getProductName() + " with Versioner "
-                            + product.getProductType().getVersioner()
-                            + ": Message: " + e.getMessage());
+            logger.error("VersioningException when versioning Product[{}] with versioner: {}: {}",
+                    product.getProductName(), product.getProductType().getVersioner(), e.getMessage());
             throw new VersioningException(e);
         } catch (Exception e) {
-            e.printStackTrace();
-            LOG.log(Level.SEVERE, "Failed to ingest product [" + product
-                    + "] : " + e.getMessage() + " -- rolling back ingest");
+            logger.error("Failed to ingest product [{}]. -- rolling back ingest", product, e);
             try {
                 AvroProduct avroProduct = AvroTypeFactory.getAvroProduct(product);
                 this.proxy.removeProduct(avroProduct);
             } catch (Exception e1) {
-                LOG.log(Level.SEVERE, "Failed to rollback ingest of product ["
-                        + product + "] : " + e.getMessage());
+                logger.error("Failed to rollback ingest of product [{}]", product, e);
             }
-            throw new Exception("Failed to ingest product [" + product + "] : "
-                    + e.getMessage());
+            throw new Exception("Failed to ingest product [" + product + "] : " + e.getMessage());
         }
     }
 
@@ -722,7 +702,6 @@
     @Override
     public void setFileManagerUrl(URL fileManagerUrl) {
         this.fileManagerUrl = fileManagerUrl;
-
     }
 
     @Override
@@ -737,6 +716,7 @@
 
     @Override
     public void close() throws IOException {
+        logger.info("Closing file manager client for URL: {}", fileManagerUrl);
         if (client != null) {
             client.close();
         }
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/AvroFileManagerServer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/AvroFileManagerServer.java
index 91258d9..84ea4fa 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/AvroFileManagerServer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/AvroFileManagerServer.java
@@ -24,32 +24,24 @@
 import org.apache.avro.ipc.specific.SpecificResponder;
 import org.apache.oodt.cas.filemgr.catalog.Catalog;
 import org.apache.oodt.cas.filemgr.datatransfer.DataTransfer;
-
 import org.apache.oodt.cas.filemgr.structs.Element;
-import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.structs.FileTransferStatus;
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.ProductPage;
 import org.apache.oodt.cas.filemgr.structs.ProductType;
 import org.apache.oodt.cas.filemgr.structs.Reference;
-import org.apache.oodt.cas.filemgr.structs.avrotypes.AvroFileManager;
-import org.apache.oodt.cas.filemgr.structs.avrotypes.AvroFileTransferStatus;
-import org.apache.oodt.cas.filemgr.structs.avrotypes.AvroProduct;
-import org.apache.oodt.cas.filemgr.structs.avrotypes.AvroElement;
-import org.apache.oodt.cas.filemgr.structs.avrotypes.AvroQueryResult;
-import org.apache.oodt.cas.filemgr.structs.avrotypes.AvroProductType;
-import org.apache.oodt.cas.filemgr.structs.avrotypes.AvroReference;
-import org.apache.oodt.cas.filemgr.structs.avrotypes.AvroProductPage;
-import org.apache.oodt.cas.filemgr.structs.avrotypes.AvroQuery;
-import org.apache.oodt.cas.filemgr.structs.avrotypes.AvroMetadata;
-import org.apache.oodt.cas.filemgr.structs.avrotypes.AvroComplexQuery;
-import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
+import org.apache.oodt.cas.filemgr.structs.avrotypes.*;
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
 import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.QueryFormulationException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
 import org.apache.oodt.cas.filemgr.structs.exceptions.ValidationLayerException;
 import org.apache.oodt.cas.filemgr.structs.exceptions.VersioningException;
-import org.apache.oodt.cas.filemgr.structs.exceptions.QueryFormulationException;
 import org.apache.oodt.cas.filemgr.structs.query.QueryResult;
 import org.apache.oodt.cas.filemgr.util.AvroTypeFactory;
 import org.apache.oodt.cas.filemgr.util.GenericFileManagerObjectFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
@@ -64,6 +56,8 @@
  */
 public class AvroFileManagerServer implements AvroFileManager, FileManagerServer {
 
+    private static final Logger logger = LoggerFactory.getLogger(AvroFileManagerServer.class);
+
     /*port for server*/
     protected int port = 1999;
 
@@ -185,8 +179,15 @@
 
     @Override
     public AvroProductPage getFirstPage(AvroProductType type) throws AvroRemoteException {
-        return AvroTypeFactory.getAvroProductPage(
-                this.fileManager.getFirstPage(AvroTypeFactory.getProductType(type)));
+        logger.debug("Getting first page for type: {}", type.getName());
+        ProductPage firstPage = this.fileManager.getFirstPage(AvroTypeFactory.getProductType(type));
+        logger.debug("Found first page for product type: {} -> {}", type.getName(), firstPage);
+        if (firstPage == null) {
+            logger.warn("No first page found for product type: {}", type.getName());
+            return null;
+        }
+
+        return AvroTypeFactory.getAvroProductPage(firstPage);
     }
 
     @Override
@@ -197,10 +198,9 @@
 
     @Override
     public AvroProductPage getNextPage(AvroProductType type, AvroProductPage currPage) throws AvroRemoteException {
-        return AvroTypeFactory.getAvroProductPage(
-                this.fileManager.getNextPage(
-                        AvroTypeFactory.getProductType(type),
-                        AvroTypeFactory.getProductPage(currPage)));
+
+        return AvroTypeFactory.getAvroProductPage(this.fileManager
+                        .getNextPage(AvroTypeFactory.getProductType(type), AvroTypeFactory.getProductPage(currPage)));
     }
 
     @Override
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/FileManager.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/FileManager.java
index fc080e4..930f17a 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/FileManager.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/FileManager.java
@@ -51,6 +51,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import com.google.common.collect.Lists;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author radu
@@ -60,6 +61,11 @@
  */
 public class FileManager {
 
+    /** Our log stream. Should be replaced by SLF4J logger */
+    @Deprecated
+    private static final Logger LOG = Logger.getLogger(FileManager.class.getName());
+    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(FileManager.class);
+
     private Catalog catalog = null;
 
     /* our RepositoryManager */
@@ -68,10 +74,6 @@
     /* our DataTransfer */
     private DataTransfer dataTransfer = null;
 
-    /* our log stream */
-    private static final Logger LOG = Logger.getLogger(FileManager.class.getName());
-
-
     /* our data transfer status tracker */
     private TransferStatusTracker transferStatusTracker = null;
 
@@ -95,6 +97,7 @@
     }
 
     public void setCatalog(Catalog catalog) {
+        LOG.fine("Setting catalog: " + catalog.toString());
         this.catalog = catalog;
     }
 
@@ -192,22 +195,20 @@
         return prodPage;
     }
 
-    public ProductPage getFirstPage(
-            ProductType type) {
+    public ProductPage getFirstPage(ProductType type) {
+        logger.debug("Getting first page for product type : {}", type.toString());
         ProductPage page = catalog.getFirstPage(type);
         try {
             setProductType(page.getPageProducts());
         } catch (Exception e) {
-            LOG.log(Level.WARNING,
-                    "Unable to set product types for product page list: ["
-                            + page + "]");
+            logger.error("Unable to set product type for product page: {}", page, e);
         }
         return page;
     }
 
-    public ProductPage getLastPage(
-            ProductType type ) {
-
+    public ProductPage getLastPage(ProductType type) {
+        LOG.fine("Getting last page for : " + type.toString());
+        logger.debug("Getting last page for : {}", type);
         ProductPage page = catalog.getLastProductPage(type);
         try {
             setProductType(page.getPageProducts());
@@ -219,10 +220,8 @@
         return page;
     }
 
-    public ProductPage getNextPage(
-            ProductType type ,
-            ProductPage currPage) {
-
+    public ProductPage getNextPage(ProductType type , ProductPage currPage) {
+        LOG.fine("Getting next page for : " + type.toString());
         ProductPage page = catalog.getNextPage(type, currPage);
         try {
             setProductType(page.getPageProducts());
@@ -234,9 +233,8 @@
         return page;
     }
 
-    public ProductPage getPrevPage(
-            ProductType type,
-            ProductPage currPage) {
+    public ProductPage getPrevPage(ProductType type, ProductPage currPage) {
+        LOG.fine("Getting previous page for : " + type.toString());
         ProductPage page = catalog.getPrevPage(type, currPage);
         try {
             setProductType(page.getPageProducts());
@@ -248,11 +246,10 @@
         return page;
     }
 
-    public String addProductType(ProductType productType)
-            throws RepositoryManagerException {
+    public String addProductType(ProductType productType) throws RepositoryManagerException {
+        LOG.fine("Adding product type : " + productType.toString());
         repositoryManager.addProductType(productType);
         return productType.getProductTypeId();
-
     }
 
     public synchronized boolean setProductTransferStatus(
@@ -897,6 +894,7 @@
     }
 
     private void setProductType(List<Product> products) throws Exception {
+        logger.debug("Setting product types for products: {}", products);
         if (products != null && products.size() > 0) {
             for (Iterator<Product> i = products.iterator(); i.hasNext();) {
                 Product p = i.next();
@@ -904,6 +902,7 @@
                     p.setProductType(repositoryManager.getProductTypeById(p
                             .getProductType().getProductTypeId()));
                 } catch (RepositoryManagerException e) {
+                    logger.error("Unable to set product type for product: {}", p, e);
                     throw new Exception(e.getMessage());
                 }
             }
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/AvroTypeFactory.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/AvroTypeFactory.java
index 2643630..b3abaec 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/AvroTypeFactory.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/AvroTypeFactory.java
@@ -27,8 +27,16 @@
 import org.apache.oodt.cas.filemgr.structs.query.filter.FilterAlgor;
 import org.apache.oodt.cas.filemgr.structs.type.TypeHandler;
 import org.apache.oodt.cas.metadata.Metadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
 
 /**
  * @author radu
@@ -40,6 +48,8 @@
  */
 public class AvroTypeFactory {
 
+    private static final Logger logger = LoggerFactory.getLogger(AvroTypeFactory.class);
+
     public static AvroReference getAvroReference(Reference reference){
 
         AvroReference avroReference = new AvroReference();
diff --git a/filemgr/src/main/resources/log4j.xml b/filemgr/src/main/resources/log4j.xml
deleted file mode 100644
index 0421de2..0000000
--- a/filemgr/src/main/resources/log4j.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-    <appender name="console" class="org.apache.log4j.ConsoleAppender">
-        <param name="Target" value="System.out"/>
-        <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
-        </layout>
-    </appender>
-
-    <root>
-        <priority value="INFO"/>
-        <appender-ref ref="console"/>
-    </root>
-
-    <logger name="org.apache.zookeeper">
-        <level value="ERROR"/>
-    </logger>
-    <logger name="org.apache.curator">
-        <level value="ERROR"/>
-    </logger>
-</log4j:configuration>
\ No newline at end of file
diff --git a/filemgr/src/main/resources/log4j2.xml b/filemgr/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..baf6b89
--- /dev/null
+++ b/filemgr/src/main/resources/log4j2.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<Configuration status="INFO">
+
+    <Appenders>
+        <Console name="Console" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+        </Console>
+        <File name="File" fileName="../logs/cas_file_mgr.log" immediateFlush="false" append="false">
+            <PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+        </File>
+    </Appenders>
+
+    <Loggers>
+        <Logger name="org.springframework" level="error"/>
+
+        <Root level="debug">
+            <AppenderRef ref="Console"/>
+            <AppenderRef ref="File"/>
+        </Root>
+    </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/filemgr/src/main/resources/logging.properties b/filemgr/src/main/resources/logging.properties
index 2e53039..30e234c 100644
--- a/filemgr/src/main/resources/logging.properties
+++ b/filemgr/src/main/resources/logging.properties
@@ -16,7 +16,7 @@
 # Specify the handlers to create in the root logger
 # (all loggers are children of the root logger)
 # The following creates two handlers
-handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
+handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler, org.slf4j.bridge.SLF4JBridgeHandler
 
 # Set the default logging level for the root logger
 .level = ALL