You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lens.apache.org by jd...@apache.org on 2015/06/23 12:24:50 UTC

[02/51] [abbrv] incubator-lens git commit: LENS-551: Cleanup testcases of exception stack traces

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-ml-lib/src/test/java/org/apache/lens/ml/TestMLResource.java
----------------------------------------------------------------------
diff --git a/lens-ml-lib/src/test/java/org/apache/lens/ml/TestMLResource.java b/lens-ml-lib/src/test/java/org/apache/lens/ml/TestMLResource.java
index c08a5b1..51344ce 100644
--- a/lens-ml-lib/src/test/java/org/apache/lens/ml/TestMLResource.java
+++ b/lens-ml-lib/src/test/java/org/apache/lens/ml/TestMLResource.java
@@ -42,8 +42,6 @@ import org.apache.lens.server.api.LensConfConstants;
 import org.apache.lens.server.query.QueryServiceResource;
 import org.apache.lens.server.session.SessionResource;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.metastore.api.Database;
 import org.apache.hadoop.hive.ql.metadata.Hive;
@@ -59,11 +57,12 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 
+import lombok.extern.slf4j.Slf4j;
 
-
+@Slf4j
 @Test
 public class TestMLResource extends LensJerseyTest {
-  private static final Log LOG = LogFactory.getLog(TestMLResource.class);
+
   private static final String TEST_DB = "default";
 
   private WebTarget mlTarget;
@@ -113,7 +112,7 @@ public class TestMLResource extends LensJerseyTest {
       hive.dropDatabase(TEST_DB);
     } catch (Exception exc) {
       // Ignore drop db exception
-      exc.printStackTrace();
+      log.error("Exception while dropping database.", exc);
     }
     mlClient.close();
   }
@@ -158,13 +157,13 @@ public class TestMLResource extends LensJerseyTest {
     Assert.assertFalse(params.isEmpty());
 
     for (String key : params.keySet()) {
-      LOG.info("## Param " + key + " help = " + params.get(key));
+      log.info("## Param " + key + " help = " + params.get(key));
     }
   }
 
   @Test
   public void trainAndEval() throws Exception {
-    LOG.info("Starting train & eval");
+    log.info("Starting train & eval");
     final String algoName = MLUtils.getAlgoName(NaiveBayesAlgo.class);
     HiveConf conf = new HiveConf();
     String tableName = "naivebayes_training_table";
@@ -177,7 +176,7 @@ public class TestMLResource extends LensJerseyTest {
     String[] features = { "feature_1", "feature_2", "feature_3" };
     String outputTable = "naivebayes_eval_table";
 
-    LOG.info("Creating training table from file "
+    log.info("Creating training table from file "
         + sampleDataFileURI.toString());
 
     Map<String, String> tableParams = new HashMap<String, String>();
@@ -185,7 +184,7 @@ public class TestMLResource extends LensJerseyTest {
       ExampleUtils.createTable(conf, TEST_DB, tableName,
           sampleDataFileURI.toString(), labelColumn, tableParams, features);
     } catch (HiveException exc) {
-      exc.printStackTrace();
+      log.error("Hive exception encountered.", exc);
     }
     MLTask.Builder taskBuilder = new MLTask.Builder();
 
@@ -198,7 +197,7 @@ public class TestMLResource extends LensJerseyTest {
 
     MLTask task = taskBuilder.build();
 
-    LOG.info("Created task " + task.toString());
+    log.info("Created task " + task.toString());
     task.run();
     Assert.assertEquals(task.getTaskState(), MLTask.State.SUCCESSFUL);
 
@@ -216,7 +215,7 @@ public class TestMLResource extends LensJerseyTest {
 
     MLTask anotherTask = taskBuilder.build();
 
-    LOG.info("Created second task " + anotherTask.toString());
+    log.info("Created second task " + anotherTask.toString());
     anotherTask.run();
 
     String secondModelID = anotherTask.getModelID();
@@ -233,7 +232,7 @@ public class TestMLResource extends LensJerseyTest {
     int i = 0;
     Set<String> partReports = new HashSet<String>();
     for (Partition part : partitions) {
-      LOG.info("@@PART#" + i + " " + part.getSpec().toString());
+      log.info("@@PART#" + i + " " + part.getSpec().toString());
       partReports.add(part.getSpec().get("part_testid"));
     }
 
@@ -243,7 +242,7 @@ public class TestMLResource extends LensJerseyTest {
     Assert.assertTrue(partReports.contains(secondReportID), secondReportID
         + " second partition not there");
 
-    LOG.info("Completed task run");
+    log.info("Completed task run");
 
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-server/src/main/java/org/apache/lens/server/LensRequestListener.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/LensRequestListener.java b/lens-server/src/main/java/org/apache/lens/server/LensRequestListener.java
index 7bf5d09..cb226d5 100644
--- a/lens-server/src/main/java/org/apache/lens/server/LensRequestListener.java
+++ b/lens-server/src/main/java/org/apache/lens/server/LensRequestListener.java
@@ -27,9 +27,12 @@ import org.apache.lens.server.api.metrics.MetricsService;
 import org.glassfish.jersey.server.monitoring.RequestEvent;
 import org.glassfish.jersey.server.monitoring.RequestEventListener;
 
+import lombok.extern.slf4j.Slf4j;
+
 /**
  * Event listener used for metrics in errors.
  */
+@Slf4j
 public class LensRequestListener implements RequestEventListener {
 
   /** The Constant HTTP_REQUESTS_STARTED. */
@@ -108,7 +111,7 @@ public class LensRequestListener implements RequestEventListener {
             metrics.incrCounter(LensRequestListener.class, HTTP_CLIENT_ERROR);
           } else {
             metrics.incrCounter(LensRequestListener.class, HTTP_UNKOWN_ERROR);
-            error.printStackTrace();
+            log.error("Encountered HTTP exception", error);
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-server/src/main/java/org/apache/lens/server/LensServletContextListener.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/LensServletContextListener.java b/lens-server/src/main/java/org/apache/lens/server/LensServletContextListener.java
index 61a0dd8..d360978 100644
--- a/lens-server/src/main/java/org/apache/lens/server/LensServletContextListener.java
+++ b/lens-server/src/main/java/org/apache/lens/server/LensServletContextListener.java
@@ -26,11 +26,14 @@ import org.apache.hive.service.CompositeService;
 import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.PropertyConfigurator;
 
+import lombok.extern.slf4j.Slf4j;
+
 /**
  * Initialize the webapp.
  *
  * @see LensServletContextEvent
  */
+@Slf4j
 public class LensServletContextListener implements ServletContextListener {
 
   /** The Constant LOG_PROPERTIES_FILE_KEY. */
@@ -58,7 +61,7 @@ public class LensServletContextListener implements ServletContextListener {
     } catch (Exception exc) {
       // Try basic configuration
       System.err.println("WARNING - log4j property configurator gave error, falling back to basic configurator");
-      exc.printStackTrace();
+      log.error("WARNING - log4j property configurator gave error, falling back to basic configurator", exc);
       BasicConfigurator.configure();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java b/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java
index 4597614..64f6cd4 100644
--- a/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java
+++ b/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java
@@ -41,14 +41,14 @@ import org.apache.hadoop.hive.ql.metadata.Table;
 import org.apache.hadoop.hive.ql.parse.ParseException;
 import org.apache.hive.service.cli.CLIService;
 import org.apache.hive.service.cli.HiveSQLException;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
 import org.apache.thrift.TException;
 
 import com.google.common.collect.Lists;
 
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
 public class CubeMetastoreServiceImpl extends LensService implements CubeMetastoreService {
-  public static final Logger LOG = LogManager.getLogger(CubeMetastoreServiceImpl.class);
 
   public CubeMetastoreServiceImpl(CLIService cliService) {
     super(NAME, cliService);
@@ -86,7 +86,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       if (!Hive.get(getSession(sessionid).getHiveConf()).databaseExists(database)) {
         throw new NotFoundException("Database " + database + " does not exist");
       }
-      LOG.info("Set database " + database);
+      log.info("Set database " + database);
       getSession(sessionid).setCurrentDatabase(database);
     } catch (HiveException e) {
       throw new LensException(e);
@@ -106,7 +106,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
     try {
       acquire(sessionid);
       Hive.get(getSession(sessionid).getHiveConf()).dropDatabase(database, false, true, cascade);
-      LOG.info("Database dropped " + database + " cascade? " + true);
+      log.info("Database dropped " + database + " cascade? " + true);
     } catch (HiveException e) {
       throw new LensException(e);
     } catch (NoSuchObjectException e) {
@@ -137,7 +137,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
     } finally {
       release(sessionid);
     }
-    LOG.info("Database created " + database);
+    log.info("Database created " + database);
   }
 
   /**
@@ -195,7 +195,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       Cube parent = cube instanceof XDerivedCube ? (Cube) msClient.getCube(
         ((XDerivedCube) cube).getParent()) : null;
       msClient.createCube(JAXBUtils.hiveCubeFromXCube(cube, parent));
-      LOG.info("Created cube " + cube.getName());
+      log.info("Created cube " + cube.getName());
     } catch (HiveException e) {
       throw new LensException(e);
     } catch (ParseException e) {
@@ -237,7 +237,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
     try {
       acquire(sessionid);
       getClient(sessionid).dropCube(cubeName);
-      LOG.info("Dropped cube " + cubeName);
+      log.info("Dropped cube " + cubeName);
     } catch (HiveException e) {
       throw new LensException(e);
     } finally {
@@ -259,7 +259,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       Cube parent = cube instanceof XDerivedCube ? (Cube) msClient.getCube(
         ((XDerivedCube) cube).getParent()) : null;
       msClient.alterCube(cube.getName(), JAXBUtils.hiveCubeFromXCube(cube, parent));
-      LOG.info("Cube updated " + cube.getName());
+      log.info("Cube updated " + cube.getName());
     } catch (HiveException e) {
       throw new LensException(e);
     } catch (ParseException e) {
@@ -288,7 +288,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
 
     try {
       acquire(sessionid);
-      LOG.info("# Columns: " + columns);
+      log.info("# Columns: " + columns);
       getClient(sessionid).createCubeDimensionTable(xDimTable.getDimensionName(),
         dimTblName,
         columns,
@@ -296,7 +296,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
         updatePeriodMap,
         properties,
         storageDesc);
-      LOG.info("Dimension Table created " + xDimTable.getTableName());
+      log.info("Dimension Table created " + xDimTable.getTableName());
     } catch (HiveException e) {
       throw new LensException(e);
     } finally {
@@ -309,9 +309,9 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
     try {
       acquire(sessionid);
       getClient(sessionid).dropDimensionTable(dimTblName, cascade);
-      LOG.info("Dropped dimension table " + dimTblName + " cascade? " + cascade);
+      log.info("Dropped dimension table " + dimTblName + " cascade? " + cascade);
     } catch (HiveException e) {
-      LOG.error("@@@@ Got HiveException: >>>>>>>" + e.getMessage() + "<<<<<<<<<");
+      log.error("@@@@ Got HiveException: >>>>>>>" + e.getMessage() + "<<<<<<<<<", e);
       throw new LensException(e);
     } finally {
       release(sessionid);
@@ -352,7 +352,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       getClient(sessionid).alterCubeDimensionTable(dimensionTable.getTableName(),
         JAXBUtils.cubeDimTableFromDimTable(dimensionTable),
         JAXBUtils.storageTableMapFromXStorageTables(dimensionTable.getStorageTables()));
-      LOG.info("Updated dimension table " + dimensionTable.getTableName());
+      log.info("Updated dimension table " + dimensionTable.getTableName());
     } catch (HiveException exc) {
       throw new LensException(exc);
     } finally {
@@ -387,7 +387,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       }
       msClient.addStorage(dimTable, storageTable.getStorageName(), period,
         JAXBUtils.storageTableDescFromXStorageTableDesc(storageTable.getTableDesc()));
-      LOG.info("Added storage " + storageTable.getStorageName() + " for dimension table " + dimTblName
+      log.info("Added storage " + storageTable.getStorageName() + " for dimension table " + dimTblName
         + " with update period " + period);
     } catch (HiveException exc) {
       throw new LensException(exc);
@@ -407,10 +407,10 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       List<String> storageNames = new ArrayList<String>(tab.getStorages());
       for (String s : storageNames) {
         msClient.dropStorageFromDim(dimTblName, s);
-        LOG.info("Dropped storage " + s + " from dimension table " + dimTblName
+        log.info("Dropped storage " + s + " from dimension table " + dimTblName
           + " [" + ++i + "/" + total + "]");
       }
-      LOG.info("Dropped " + total + " storages from dimension table " + dimTblName);
+      log.info("Dropped " + total + " storages from dimension table " + dimTblName);
     } catch (HiveException exc) {
       throw new LensException(exc);
     } finally {
@@ -451,10 +451,10 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       List<String> storageNames = new ArrayList<String>(tab.getStorages());
       for (String s : storageNames) {
         msClient.dropStorageFromFact(factName, s);
-        LOG.info("Dropped storage " + s + " from fact table " + factName
+        log.info("Dropped storage " + s + " from fact table " + factName
           + " [" + ++i + "/" + total + "]");
       }
-      LOG.info("Dropped " + total + " storages from fact table " + factName);
+      log.info("Dropped " + total + " storages from fact table " + factName);
     } catch (HiveException exc) {
       throw new LensException(exc);
     } finally {
@@ -474,7 +474,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       }
 
       msClient.dropStorageFromDim(dimTblName, storage);
-      LOG.info("Dropped storage " + storage + " from dimension table " + dimTblName);
+      log.info("Dropped storage " + storage + " from dimension table " + dimTblName);
     } catch (HiveException exc) {
       throw new LensException(exc);
     } finally {
@@ -518,7 +518,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
         fact.getWeight(),
         JAXBUtils.mapFromXProperties(fact.getProperties()),
         JAXBUtils.storageTableMapFromXStorageTables(fact.getStorageTables()));
-      LOG.info("Created fact table " + fact.getName());
+      log.info("Created fact table " + fact.getName());
     } catch (HiveException e) {
       throw new LensException(e);
     } finally {
@@ -532,7 +532,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       acquire(sessionid);
       getClient(sessionid).alterCubeFactTable(fact.getName(), JAXBUtils.cubeFactFromFactTable(fact),
         JAXBUtils.storageTableMapFromXStorageTables(fact.getStorageTables()));
-      LOG.info("Updated fact table " + fact.getName());
+      log.info("Updated fact table " + fact.getName());
     } catch (HiveException e) {
       throw new LensException(e);
     } finally {
@@ -545,7 +545,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
     try {
       acquire(sessionid);
       getClient(sessionid).dropFact(fact, cascade);
-      LOG.info("Dropped fact table " + fact + " cascade? " + cascade);
+      log.info("Dropped fact table " + fact + " cascade? " + cascade);
     } catch (HiveException e) {
       throw new LensException(e);
     } finally {
@@ -653,7 +653,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       msClient.addStorage(msClient.getFactTable(fact),
         storageTable.getStorageName(), updatePeriods,
         JAXBUtils.storageTableDescFromXStorageTableElement(storageTable));
-      LOG.info("Added storage " + storageTable.getStorageName() + ":" + updatePeriods + " for fact " + fact);
+      log.info("Added storage " + storageTable.getStorageName() + ":" + updatePeriods + " for fact " + fact);
     } catch (HiveException exc) {
       throw new LensException(exc);
     } finally {
@@ -667,7 +667,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       acquire(sessionid);
       checkFactStorage(sessionid, fact, storage);
       getClient(sessionid).dropStorageFromFact(fact, storage);
-      LOG.info("Dropped storage " + storage + " from fact " + fact);
+      log.info("Dropped storage " + storage + " from fact " + fact);
     } catch (HiveException exc) {
       throw new LensException(exc);
     } finally {
@@ -797,7 +797,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       getClient(sessionid).addPartition(
         JAXBUtils.storagePartSpecFromXPartition(partition),
         storageName);
-      LOG.info("Added partition for dimension: " + dimTblName + " storage: " + storageName);
+      log.info("Added partition for dimension: " + dimTblName + " storage: " + storageName);
     } catch (HiveException exc) {
       throw new LensException(exc);
     } finally {
@@ -826,7 +826,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
     List<FieldSchema> cols = client.getHiveTable(tableName).getPartCols();
     String[] vals = StringUtils.split(values, ",");
     if (vals.length != cols.size()) {
-      LOG.error("Values for all the part columns not specified, cols:" + cols + " vals:" + vals);
+      log.error("Values for all the part columns not specified, cols:" + cols + " vals:" + vals);
       throw new BadRequestException("Values for all the part columns not specified");
     }
     StringBuilder filter = new StringBuilder();
@@ -881,10 +881,10 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       List<Partition> partitions = msClient.getPartitionsByFilter(
         tableName, filter);
       if (partitions.size() > 1) {
-        LOG.error("More than one partition with specified values, correspoding filter:" + filter);
+        log.error("More than one partition with specified values, correspoding filter:" + filter);
         throw new BadRequestException("More than one partition with specified values");
       } else if (partitions.size() == 0) {
-        LOG.error("No partition exists with specified values, correspoding filter:" + filter);
+        log.error("No partition exists with specified values, correspoding filter:" + filter);
         throw new NotFoundException("No partition exists with specified values");
       }
       Map<String, Date> timeSpec = new HashMap<String, Date>();
@@ -892,7 +892,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       UpdatePeriod updatePeriod = populatePartSpec(partitions.get(0), timeSpec, nonTimeSpec);
       msClient.dropPartition(cubeTableName,
         storageName, timeSpec, nonTimeSpec, updatePeriod);
-      LOG.info("Dropped partition  for dimension: " + cubeTableName
+      log.info("Dropped partition  for dimension: " + cubeTableName
         + " storage: " + storageName + " values:" + values);
     } catch (HiveException exc) {
       throw new LensException(exc);
@@ -924,7 +924,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
           }
         }
       }
-      LOG.info("Dropped partition  for cube table: " + cubeTableName
+      log.info("Dropped partition  for cube table: " + cubeTableName
         + " storage: " + storageName + " by filter:" + filter);
     } catch (HiveException exc) {
       throw new LensException(exc);
@@ -939,7 +939,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
     try {
       acquire(sessionid);
       getClient(sessionid).createStorage(JAXBUtils.storageFromXStorage(storage));
-      LOG.info("Created storage " + storage.getName());
+      log.info("Created storage " + storage.getName());
     } catch (HiveException e) {
       throw new LensException(e);
     } finally {
@@ -954,7 +954,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
     try {
       acquire(sessionid);
       getClient(sessionid).dropStorage(storageName);
-      LOG.info("Dropped storage " + storageName);
+      log.info("Dropped storage " + storageName);
     } catch (HiveException e) {
       throw new LensException(e);
     } finally {
@@ -969,7 +969,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       acquire(sessionid);
       getClient(sessionid).alterStorage(storageName,
         JAXBUtils.storageFromXStorage(storage));
-      LOG.info("Altered storage " + storageName);
+      log.info("Altered storage " + storageName);
     } catch (HiveException e) {
       throw new LensException(e);
     } finally {
@@ -1086,7 +1086,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
     try {
       acquire(sessionid);
       getClient(sessionid).createDimension(JAXBUtils.dimensionFromXDimension(dimension));
-      LOG.info("Created dimension " + dimension.getName());
+      log.info("Created dimension " + dimension.getName());
     } catch (HiveException e) {
       throw new LensException(e);
     } catch (ParseException e) {
@@ -1115,7 +1115,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
     try {
       acquire(sessionid);
       getClient(sessionid).dropDimension(dimName);
-      LOG.info("Dropped dimension " + dimName);
+      log.info("Dropped dimension " + dimName);
     } catch (HiveException e) {
       throw new LensException(e);
     } finally {
@@ -1130,7 +1130,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       acquire(sessionid);
       getClient(sessionid).alterDimension(dimName,
         JAXBUtils.dimensionFromXDimension(dimension));
-      LOG.info("Altered dimension " + dimName);
+      log.info("Altered dimension " + dimName);
     } catch (HiveException e) {
       throw new LensException(e);
     } catch (ParseException e) {
@@ -1222,7 +1222,7 @@ public class CubeMetastoreServiceImpl extends LensService implements CubeMetasto
       if (!StringUtils.isBlank(dbName)) {
         tables = getTablesFromDB(sessionid, dbName, false);
       } else {
-        LOG.info("Getting tables from all dbs");
+        log.info("Getting tables from all dbs");
         List<String> alldbs = getAllDatabases(sessionid);
         tables = new ArrayList<String>();
         for (String db : alldbs) {

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java b/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java
index a628c90..b6d5fec 100644
--- a/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java
+++ b/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java
@@ -38,20 +38,20 @@ import org.apache.hadoop.hive.ql.metadata.Partition;
 import org.apache.hadoop.hive.ql.metadata.Table;
 import org.apache.hadoop.hive.ql.parse.ParseException;
 import org.apache.hadoop.hive.serde.serdeConstants;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
 
 import com.google.common.base.Optional;
 
+import lombok.extern.slf4j.Slf4j;
+
 /**
  * Utilities for converting to and from JAXB types to hive.ql.metadata.cube types
  */
+@Slf4j
 public final class JAXBUtils {
   private JAXBUtils() {
 
   }
 
-  public static final Logger LOG = LogManager.getLogger(JAXBUtils.class);
   private static final ObjectFactory XCF = new ObjectFactory();
 
   /**
@@ -223,7 +223,7 @@ public final class JAXBUtils {
     try {
       return DatatypeFactory.newInstance().newXMLGregorianCalendar(c1);
     } catch (DatatypeConfigurationException e) {
-      LOG.warn("Error converting date " + d, e);
+      log.warn("Error converting date " + d, e);
       return null;
     }
   }
@@ -322,7 +322,7 @@ public final class JAXBUtils {
         xcc.setChainName(rd.getChainName());
         xcc.setRefCol(rd.getRefColumn());
         if (baseTable.getChainByName(rd.getChainName()) == null) {
-          LOG.error("Missing chain definition for " + rd.getChainName());
+          log.error("Missing chain definition for " + rd.getChainName());
         } else {
           xcc.setDestTable(baseTable.getChainByName(rd.getChainName()).getDestTable());
         }
@@ -568,7 +568,7 @@ public final class JAXBUtils {
       storage.addProperties(mapFromXProperties(xs.getProperties()));
       return storage;
     } catch (Exception e) {
-      LOG.error("Could not create storage class" + xs.getClassname() + "with name:" + xs.getName());
+      log.error("Could not create storage class" + xs.getClassname() + "with name:" + xs.getName(), e);
       throw new WebApplicationException(e);
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-server/src/main/java/org/apache/lens/server/metrics/MetricsServiceImpl.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/metrics/MetricsServiceImpl.java b/lens-server/src/main/java/org/apache/lens/server/metrics/MetricsServiceImpl.java
index ee24e1f..6e8b3a6 100644
--- a/lens-server/src/main/java/org/apache/lens/server/metrics/MetricsServiceImpl.java
+++ b/lens-server/src/main/java/org/apache/lens/server/metrics/MetricsServiceImpl.java
@@ -45,7 +45,6 @@ import org.apache.lens.server.api.session.SessionService;
 
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hive.service.AbstractService;
-import org.apache.log4j.Logger;
 
 import org.glassfish.jersey.server.ContainerRequest;
 import org.glassfish.jersey.server.model.ResourceMethod;
@@ -63,14 +62,14 @@ import info.ganglia.gmetric4j.gmetric.GMetric;
 import info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode;
 import lombok.Getter;
 
+import lombok.extern.slf4j.Slf4j;
+
 /**
  * The Class MetricsServiceImpl.
  */
+@Slf4j
 public class MetricsServiceImpl extends AbstractService implements MetricsService {
 
-  /** The Constant LOG. */
-  public static final Logger LOG = Logger.getLogger(MetricsService.class);
-
   /** The query status listener. */
   private AsyncEventListener<StatusChange> queryStatusListener;
 
@@ -132,7 +131,7 @@ public class MetricsServiceImpl extends AbstractService implements MetricsServic
   private boolean enableResourceMethodMetering;
 
   public void setEnableResourceMethodMetering(boolean enableResourceMethodMetering) {
-    LOG.info("setEnableResourceMethodMetering: " + enableResourceMethodMetering);
+    log.info("setEnableResourceMethodMetering: " + enableResourceMethodMetering);
     this.enableResourceMethodMetering = enableResourceMethodMetering;
     if (!enableResourceMethodMetering) {
       methodMetricsFactory.clear();
@@ -273,7 +272,7 @@ public class MetricsServiceImpl extends AbstractService implements MetricsServic
 
         reporters.add(greporter);
       } catch (IOException e) {
-        LOG.error("Could not start ganglia reporter", e);
+        log.error("Could not start ganglia reporter", e);
       }
     }
     if (hiveConf.getBoolean(LensConfConstants.ENABLE_GRAPHITE_METRICS, false)) {
@@ -289,10 +288,10 @@ public class MetricsServiceImpl extends AbstractService implements MetricsServic
           .build(graphite);
         reporters.add(reporter);
       } catch (UnknownHostException e) {
-        LOG.error("Couldn't get localhost. So couldn't setup graphite reporting");
+        log.error("Couldn't get localhost. So couldn't setup graphite reporting", e);
       }
     }
-    LOG.info("Started metrics service");
+    log.info("Started metrics service");
     super.init(hiveConf);
   }
 
@@ -416,7 +415,7 @@ public class MetricsServiceImpl extends AbstractService implements MetricsServic
       }
     }
 
-    LOG.info("Stopped metrics service");
+    log.info("Stopped metrics service");
     super.stop();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-server/src/main/java/org/apache/lens/server/query/LensServerDAO.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/query/LensServerDAO.java b/lens-server/src/main/java/org/apache/lens/server/query/LensServerDAO.java
index a57888d..1904350 100644
--- a/lens-server/src/main/java/org/apache/lens/server/query/LensServerDAO.java
+++ b/lens-server/src/main/java/org/apache/lens/server/query/LensServerDAO.java
@@ -37,17 +37,14 @@ import org.apache.commons.dbutils.handlers.BeanHandler;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.hadoop.conf.Configuration;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
 
 /**
  * Top level class which logs and retrieves finished query from Database.
  */
+@Slf4j
 public class LensServerDAO {
 
-  /** The Constant LOG. */
-  private static final Logger LOG = LoggerFactory.getLogger(LensServerDAO.class);
-
   /** The ds. */
   private DataSource ds;
 
@@ -83,7 +80,7 @@ public class LensServerDAO {
     try {
       runner.update("drop table finished_queries");
     } catch (SQLException e) {
-      e.printStackTrace();
+      log.error("SQL exception while dropping finished queries table.", e);
     }
   }
 
@@ -102,9 +99,9 @@ public class LensServerDAO {
     try {
       createTable(sql);
       ds.getConnection().commit();
-      LOG.info("Created finished queries table");
+      log.info("Created finished queries table");
     } catch (SQLException e) {
-      LOG.warn("Unable to create finished queries table", e);
+      log.warn("Unable to create finished queries table", e);
     }
   }
 
@@ -128,10 +125,10 @@ public class LensServerDAO {
         query.getErrorMessage(), query.getDriverStartTime(), query.getDriverEndTime(), query.getMetadataClass(),
         query.getQueryName(), query.getSubmissionTime());
     } else {
-      LOG.warn("Re insert happening in purge: " + Thread.currentThread().getStackTrace());
+      log.warn("Re insert happening in purge: " + Thread.currentThread().getStackTrace());
       if (alreadyExisting.equals(query)) {
         // This is also okay
-        LOG.warn("Skipping Re-insert. Finished Query found in DB while trying to insert, handle=" + query.getHandle());
+        log.warn("Skipping Re-insert. Finished Query found in DB while trying to insert, handle=" + query.getHandle());
       } else {
         String msg = "Found different value pre-existing in DB while trying to insert finished query. "
           + "Old = " + alreadyExisting + "\nNew = " + query;
@@ -155,7 +152,7 @@ public class LensServerDAO {
     try {
       return runner.query(sql, rsh, handle);
     } catch (SQLException e) {
-      e.printStackTrace();
+      log.error("SQL exception while executing query.", e);
     }
     return null;
   }
@@ -212,7 +209,7 @@ public class LensServerDAO {
           try {
             queryHandleList.add(QueryHandle.fromString(handle));
           } catch (IllegalArgumentException exc) {
-            LOG.warn("Warning invalid query handle found in DB " + handle);
+            log.warn("Warning invalid query handle found in DB " + handle);
           }
         }
         return queryHandleList;

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java b/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java
index 4cf1fa9..7c2da3a 100644
--- a/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java
+++ b/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java
@@ -73,19 +73,17 @@ import org.codehaus.jackson.map.*;
 import org.codehaus.jackson.map.module.SimpleModule;
 
 import com.google.common.collect.ImmutableList;
+
 import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
 
 /**
  * The Class QueryExecutionServiceImpl.
  */
+@Slf4j
 public class QueryExecutionServiceImpl extends LensService implements QueryExecutionService {
 
   /**
-   * The Constant LOG.
-   */
-  public static final Log LOG = LogFactory.getLog(QueryExecutionServiceImpl.class);
-
-  /**
    * The Constant PREPARED_QUERIES_COUNTER.
    */
   public static final String PREPARED_QUERIES_COUNTER = "prepared-queries";
@@ -239,7 +237,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     public void onEvent(DriverEvent event) {
       // Need to restore session only in case of hive driver
       if (event instanceof DriverSessionStarted) {
-        LOG.info("New driver event by driver " + event.getDriver());
+        log.info("New driver event by driver " + event.getDriver());
         handleDriverSessionStart(event);
       }
     }
@@ -266,10 +264,10 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
         try {
           Class<?> clazz = Class.forName(acceptorClass);
           QueryAcceptor acceptor = (QueryAcceptor) clazz.newInstance();
-          LOG.info("initialized query acceptor: " + acceptor);
+          log.info("initialized query acceptor: " + acceptor);
           queryAcceptors.add(acceptor);
         } catch (Exception e) {
-          LOG.warn("Could not load the acceptor:" + acceptorClass, e);
+          log.warn("Could not load the acceptor:" + acceptorClass, e);
           throw new LensException("Could not load acceptor" + acceptorClass, e);
         }
       }
@@ -279,14 +277,14 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   private void initializeListeners() {
     if (conf.getBoolean(LensConfConstants.QUERY_STATE_LOGGER_ENABLED, true)) {
       getEventService().addListenerForType(new QueryStatusLogger(), StatusChange.class);
-      LOG.info("Registered query state logger");
+      log.info("Registered query state logger");
     }
     // Add result formatter
     getEventService().addListenerForType(new ResultFormatter(this), QueryExecuted.class);
     getEventService().addListenerForType(new QueryExecutionStatisticsGenerator(this, getEventService()),
       QueryEnded.class);
     getEventService().addListenerForType(new QueryEndNotifier(this, getCliService().getHiveConf()), QueryEnded.class);
-    LOG.info("Registered query result formatter");
+    log.info("Registered query result formatter");
   }
 
   /**
@@ -308,9 +306,9 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
           }
 
           drivers.put(driverClass, driver);
-          LOG.info("Driver for " + driverClass + " is loaded");
+          log.info("Driver for " + driverClass + " is loaded");
         } catch (Exception e) {
-          LOG.warn("Could not load the driver:" + driverClass, e);
+          log.warn("Could not load the driver:" + driverClass, e);
           throw new LensException("Could not load driver " + driverClass, e);
         }
       }
@@ -321,7 +319,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       Class<? extends DriverSelector> driverSelectorClass = conf.getClass(LensConfConstants.DRIVER_SELECTOR_CLASS,
         MinQueryCostSelector.class,
         DriverSelector.class);
-      LOG.info("Using driver selector class: " + driverSelectorClass.getCanonicalName());
+      log.info("Using driver selector class: " + driverSelectorClass.getCanonicalName());
       driverSelector = driverSelectorClass.newInstance();
     } catch (Exception e) {
       throw new LensException("Couldn't instantiate driver selector class. Class name: "
@@ -371,6 +369,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   /**
    * The Class QueryStatusLogger.
    */
+  @Slf4j
   public static class QueryStatusLogger implements LensEventListener<StatusChange> {
 
     /**
@@ -476,13 +475,13 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
      */
     @Override
     public void run() {
-      LOG.info("Starting QuerySubmitter thread");
+      log.info("Starting QuerySubmitter thread");
       while (!pausedForTest && !stopped && !querySubmitter.isInterrupted()) {
         try {
           QueryContext ctx = queuedQueries.take();
           synchronized (ctx) {
             if (ctx.getStatus().getStatus().equals(Status.QUEUED)) {
-              LOG.info("Launching query:" + ctx.getUserQuery());
+              log.info("Launching query:" + ctx.getUserQuery());
               try {
                 // acquire session before any query operation.
                 acquire(ctx.getLensSessionIdentifier());
@@ -490,13 +489,13 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
                 if (!ctx.isDriverQueryExplicitlySet()) {
                   rewriteAndSelect(ctx);
                 } else {
-                  LOG.info("Submitting to already selected driver");
+                  log.info("Submitting to already selected driver");
                 }
                 // Check if we need to pass session's effective resources to selected driver
                 addSessionResourcesToDriver(ctx);
                 ctx.getSelectedDriver().executeAsync(ctx);
               } catch (Exception e) {
-                LOG.error("Error launching query " + ctx.getQueryHandle(), e);
+                log.error("Error launching query " + ctx.getQueryHandle(), e);
                 String reason = e.getCause() != null ? e.getCause().getMessage() : e.getMessage();
                 setFailedStatus(ctx, "Launching query failed", reason);
                 continue;
@@ -504,18 +503,18 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
                 release(ctx.getLensSessionIdentifier());
               }
               setLaunchedStatus(ctx);
-              LOG.info("Launched query " + ctx.getQueryHandle());
+              log.info("Launched query " + ctx.getQueryHandle());
             }
           }
         } catch (InterruptedException e) {
-          LOG.info("Query Submitter has been interrupted, exiting");
+          log.info("Query Submitter has been interrupted, exiting");
           return;
         } catch (Exception e) {
           incrCounter(QUERY_SUBMITTER_COUNTER);
-          LOG.error("Error in query submitter", e);
+          log.error("Error in query submitter", e);
         }
       }
-      LOG.info("QuerySubmitter exited");
+      log.info("QuerySubmitter exited");
     }
   }
 
@@ -545,7 +544,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
      */
     @Override
     public void run() {
-      LOG.info("Starting Status poller thread");
+      log.info("Starting Status poller thread");
       while (!stopped && !statusPoller.isInterrupted()) {
         try {
           List<QueryContext> launched = new ArrayList<QueryContext>();
@@ -554,25 +553,25 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
             if (stopped || statusPoller.isInterrupted()) {
               return;
             }
-            LOG.info("Polling status for " + ctx.getQueryHandle());
+            log.info("Polling status for " + ctx.getQueryHandle());
             try {
               // session is not required to update status of the query
               // don't need to wrap this with acquire/release
               updateStatus(ctx.getQueryHandle());
             } catch (LensException e) {
-              LOG.error("Error updating status ", e);
+              log.error("Error updating status ", e);
             }
           }
           Thread.sleep(pollInterval);
         } catch (InterruptedException e) {
-          LOG.info("Status poller has been interrupted, exiting");
+          log.info("Status poller has been interrupted, exiting");
           return;
         } catch (Exception e) {
           incrCounter(STATUS_UPDATE_COUNTER);
-          LOG.error("Error in status poller", e);
+          log.error("Error in status poller", e);
         }
       }
-      LOG.info("StatusPoller exited");
+      log.info("StatusPoller exited");
     }
   }
 
@@ -655,14 +654,14 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
         QueryStatus before = ctx.getStatus();
         if (!ctx.getStatus().getStatus().equals(QueryStatus.Status.QUEUED) && !ctx.getDriverStatus().isFinished()
           && !ctx.getStatus().finished()) {
-          LOG.info("Updating status for " + ctx.getQueryHandle());
+          log.info("Updating status for " + ctx.getQueryHandle());
           try {
             ctx.getSelectedDriver().updateStatus(ctx);
             ctx.setStatus(ctx.getDriverStatus().toQueryStatus());
           } catch (LensException exc) {
             // Driver gave exception while updating status
             setFailedStatus(ctx, "Status update failed", exc.getMessage());
-            LOG.error("Status update failed for " + handle, exc);
+            log.error("Status update failed for " + handle, exc);
           }
           // query is successfully executed by driver and
           // if query result need not be persisted or there is no result available in driver, move the query to
@@ -712,7 +711,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     case SUCCESSFUL:
       return new QuerySuccess(ctx.getEndTime(), prevState, currState, query);
     default:
-      LOG.warn("Query " + query + " transitioned to " + currState + " state from " + prevState + " state");
+      log.warn("Query " + query + " transitioned to " + currState + " state from " + prevState + " state");
       return null;
     }
   }
@@ -741,7 +740,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       try {
         getEventService().notifyEvent(event);
       } catch (LensException e) {
-        LOG.warn("LensEventService encountered error while handling event: " + event.getEventId(), e);
+        log.warn("LensEventService encountered error while handling event: " + event.getEventId(), e);
       }
     }
   }
@@ -758,13 +757,13 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
      */
     @Override
     public void run() {
-      LOG.info("Starting Query purger thread");
+      log.info("Starting Query purger thread");
       while (!stopped && !queryPurger.isInterrupted()) {
         FinishedQuery finished = null;
         try {
           finished = finishedQueries.take();
         } catch (InterruptedException e) {
-          LOG.info("QueryPurger has been interrupted, exiting");
+          log.info("QueryPurger has been interrupted, exiting");
           return;
         }
         try {
@@ -785,9 +784,9 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
           }
           try {
             lensServerDao.insertFinishedQuery(finishedQuery);
-            LOG.info("Saved query " + finishedQuery.getHandle() + " to DB");
+            log.info("Saved query " + finishedQuery.getHandle() + " to DB");
           } catch (Exception e) {
-            LOG.warn("Exception while purging query ", e);
+            log.warn("Exception while purging query ", e);
             finishedQueries.add(finished);
             continue;
           }
@@ -799,24 +798,24 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
                 finished.getCtx().getSelectedDriver().closeQuery(finished.getCtx().getQueryHandle());
               }
             } catch (Exception e) {
-              LOG.warn("Exception while closing query with selected driver.", e);
+              log.warn("Exception while closing query with selected driver.", e);
             }
-            LOG.info("Purging: " + finished.getCtx().getQueryHandle());
+            log.info("Purging: " + finished.getCtx().getQueryHandle());
             allQueries.remove(finished.getCtx().getQueryHandle());
             resultSets.remove(finished.getCtx().getQueryHandle());
           }
           fireStatusChangeEvent(finished.getCtx(),
             new QueryStatus(1f, Status.CLOSED, "Query purged", false, null, null), finished.getCtx().getStatus());
-          LOG.info("Query purged: " + finished.getCtx().getQueryHandle());
+          log.info("Query purged: " + finished.getCtx().getQueryHandle());
         } catch (LensException e) {
           incrCounter(QUERY_PURGER_COUNTER);
-          LOG.error("Error closing  query ", e);
+          log.error("Error closing  query ", e);
         } catch (Exception e) {
           incrCounter(QUERY_PURGER_COUNTER);
-          LOG.error("Error in query purger", e);
+          log.error("Error in query purger", e);
         }
       }
-      LOG.info("QueryPurger exited");
+      log.info("QueryPurger exited");
     }
   }
 
@@ -832,24 +831,24 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
      */
     @Override
     public void run() {
-      LOG.info("Starting Prepared Query purger thread");
+      log.info("Starting Prepared Query purger thread");
       while (!stopped && !prepareQueryPurger.isInterrupted()) {
         try {
           PreparedQueryContext prepared = preparedQueryQueue.take();
           destroyPreparedQuery(prepared);
-          LOG.info("Purged prepared query: " + prepared.getPrepareHandle());
+          log.info("Purged prepared query: " + prepared.getPrepareHandle());
         } catch (LensException e) {
           incrCounter(PREPARED_QUERY_PURGER_COUNTER);
-          LOG.error("Error closing prepared query ", e);
+          log.error("Error closing prepared query ", e);
         } catch (InterruptedException e) {
-          LOG.info("PreparedQueryPurger has been interrupted, exiting");
+          log.info("PreparedQueryPurger has been interrupted, exiting");
           return;
         } catch (Exception e) {
           incrCounter(PREPARED_QUERY_PURGER_COUNTER);
-          LOG.error("Error in prepared query purger", e);
+          log.error("Error in prepared query purger", e);
         }
       }
-      LOG.info("PreparedQueryPurger exited");
+      log.info("PreparedQueryPurger exited");
     }
   }
 
@@ -875,7 +874,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     maxFinishedQueries = conf.getInt(LensConfConstants.MAX_NUMBER_OF_FINISHED_QUERY,
       LensConfConstants.DEFAULT_FINISHED_QUERIES);
     initalizeFinishedQueryStore(conf);
-    LOG.info("Query execution service initialized");
+    log.info("Query execution service initialized");
   }
 
   /**
@@ -889,7 +888,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     try {
       this.lensServerDao.createFinishedQueriesTable();
     } catch (Exception e) {
-      LOG.warn("Unable to create finished query table, query purger will not purge queries", e);
+      log.warn("Unable to create finished query table, query purger will not purge queries", e);
     }
     SimpleModule module = new SimpleModule("HiveColumnModule", new Version(1, 0, 0, null));
     module.addSerializer(ColumnDescriptor.class, new JsonSerializer<ColumnDescriptor>() {
@@ -940,15 +939,15 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     super.stop();
     for (Thread th : new Thread[]{querySubmitter, statusPoller, queryPurger, prepareQueryPurger}) {
       try {
-        LOG.debug("Waiting for" + th.getName());
+        log.debug("Waiting for" + th.getName());
         th.join();
       } catch (InterruptedException e) {
-        LOG.error("Error waiting for thread: " + th.getName(), e);
+        log.error("Error waiting for thread: " + th.getName(), e);
       }
     }
 
     estimatePool.shutdownNow();
-    LOG.info("Query execution service stopped");
+    log.info("Query execution service stopped");
   }
 
   /*
@@ -973,7 +972,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
             }
           }
         } catch (LensException e) {
-          LOG.error("Could not set query conf ", e);
+          log.error("Could not set query conf ", e);
         }
       }
     }
@@ -1068,7 +1067,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
               ++inCompleteDrivers;
               // Cancel the corresponding task
               estimateFutures.get(i).cancel(true);
-              LOG.warn("Timeout reached for estimate task for driver " + r.getDriver() + " " + debugInfo);
+              log.warn("Timeout reached for estimate task for driver " + r.getDriver() + " " + debugInfo);
             }
           }
 
@@ -1188,20 +1187,20 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
           if (!succeeded) {
             failureCause = estimateRunnable.getFailureCause();
             cause = estimateRunnable.getCause();
-            LOG.error("Estimate failed for driver " + driver + " cause: " + failureCause);
+            log.error("Estimate failed for driver " + driver + " cause: " + failureCause);
           }
           estimateGauge.markSuccess();
         } else {
-          LOG.error("Estimate skipped since rewrite failed for driver " + driver + " cause: " + failureCause);
+          log.error("Estimate skipped since rewrite failed for driver " + driver + " cause: " + failureCause);
         }
       } catch (Throwable th) {
-        LOG.error("Error computing estimate for driver " + driver, th);
+        log.error("Error computing estimate for driver " + driver, th);
       } finally {
         completed = true;
         try {
           release(ctx.getLensSessionIdentifier());
         } catch (LensException e) {
-          LOG.error("Could not release session: " + ctx.getLensSessionIdentifier(), e);
+          log.error("Could not release session: " + ctx.getLensSessionIdentifier(), e);
         } finally {
           estimateCompletionLatch.countDown();
         }
@@ -1368,7 +1367,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     throws LensException {
     PreparedQueryContext prepared = null;
     try {
-      LOG.info("ExplainAndPrepare: " + sessionHandle.toString() + " query: " + query);
+      log.info("ExplainAndPrepare: " + sessionHandle.toString() + " query: " + query);
       acquire(sessionHandle);
       prepared = prepareQuery(sessionHandle, query, lensConf, SubmitOp.EXPLAIN_AND_PREPARE);
       prepared.setQueryName(queryName);
@@ -1380,7 +1379,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       if (prepared != null) {
         destroyPreparedQuery(prepared);
       }
-      LOG.error("Explain and prepare failed", e);
+      log.error("Explain and prepare failed", e);
       QueryPlan plan;
       if (e.getCause() != null && e.getCause().getMessage() != null) {
         plan = new QueryPlan(true, e.getCause().getMessage());
@@ -1406,7 +1405,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   public QueryHandle executePrepareAsync(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle,
     LensConf conf, String queryName) throws LensException {
     try {
-      LOG.info("ExecutePrepareAsync: " + sessionHandle.toString() + " query:" + prepareHandle.getPrepareHandleId());
+      log.info("ExecutePrepareAsync: " + sessionHandle.toString() + " query:" + prepareHandle.getPrepareHandleId());
       acquire(sessionHandle);
       PreparedQueryContext pctx = getPreparedQueryContext(sessionHandle, prepareHandle);
       Configuration qconf = getLensConf(sessionHandle, conf);
@@ -1434,7 +1433,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   public QueryHandleWithResultSet executePrepare(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle,
     long timeoutMillis, LensConf conf, String queryName) throws LensException {
     try {
-      LOG.info("ExecutePrepare: " + sessionHandle.toString() + " query:" + prepareHandle.getPrepareHandleId()
+      log.info("ExecutePrepare: " + sessionHandle.toString() + " query:" + prepareHandle.getPrepareHandleId()
         + " timeout:" + timeoutMillis);
       acquire(sessionHandle);
       PreparedQueryContext pctx = getPreparedQueryContext(sessionHandle, prepareHandle);
@@ -1462,7 +1461,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   public QueryHandle executeAsync(LensSessionHandle sessionHandle, String query, LensConf conf, String queryName)
     throws LensException {
     try {
-      LOG.info("ExecuteAsync: " + sessionHandle.toString() + " query: " + query);
+      log.info("ExecuteAsync: " + sessionHandle.toString() + " query: " + query);
       acquire(sessionHandle);
       Configuration qconf = getLensConf(sessionHandle, conf);
       accept(query, qconf, SubmitOp.EXECUTE);
@@ -1521,7 +1520,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     queuedQueries.add(ctx);
     allQueries.put(ctx.getQueryHandle(), ctx);
     fireStatusChangeEvent(ctx, ctx.getStatus(), before);
-    LOG.info("Returning handle " + ctx.getQueryHandle().getHandleId());
+    log.info("Returning handle " + ctx.getQueryHandle().getHandleId());
     return ctx.getQueryHandle();
   }
 
@@ -1535,7 +1534,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   public boolean updateQueryConf(LensSessionHandle sessionHandle, QueryHandle queryHandle, LensConf newconf)
     throws LensException {
     try {
-      LOG.info("UpdateQueryConf:" + sessionHandle.toString() + " query: " + queryHandle);
+      log.info("UpdateQueryConf:" + sessionHandle.toString() + " query: " + queryHandle);
       acquire(sessionHandle);
       QueryContext ctx = getQueryContext(sessionHandle, queryHandle);
       if (ctx != null && ctx.getStatus().getStatus() == QueryStatus.Status.QUEUED) {
@@ -1560,7 +1559,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   public boolean updateQueryConf(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle, LensConf newconf)
     throws LensException {
     try {
-      LOG.info("UpdatePreparedQueryConf:" + sessionHandle.toString() + " query: " + prepareHandle);
+      log.info("UpdatePreparedQueryConf:" + sessionHandle.toString() + " query: " + prepareHandle);
       acquire(sessionHandle);
       PreparedQueryContext ctx = getPreparedQueryContext(sessionHandle, prepareHandle);
       ctx.updateConf(newconf.getProperties());
@@ -1663,7 +1662,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   public QueryHandleWithResultSet execute(LensSessionHandle sessionHandle, String query, long timeoutMillis,
     LensConf conf, String queryName) throws LensException {
     try {
-      LOG.info("Blocking execute " + sessionHandle.toString() + " query: " + query + " timeout: " + timeoutMillis);
+      log.info("Blocking execute " + sessionHandle.toString() + " query: " + query + " timeout: " + timeoutMillis);
       acquire(sessionHandle);
       Configuration qconf = getLensConf(sessionHandle, conf);
       accept(query, qconf, SubmitOp.EXECUTE);
@@ -1694,7 +1693,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       try {
         Thread.sleep(10);
       } catch (InterruptedException e) {
-        e.printStackTrace();
+        log.error("Encountered Interrupted exception.", e);
       }
     }
     QueryCompletionListener listener = new QueryCompletionListenerImpl(handle);
@@ -1708,7 +1707,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
         listener.wait(timeoutMillis);
       }
     } catch (InterruptedException e) {
-      LOG.info("Waiting thread interrupted");
+      log.info("Waiting thread interrupted");
     }
     if (getQueryContext(sessionHandle, handle).getStatus().finished()) {
       result.setResult(getResultset(handle).toQueryResult());
@@ -1750,7 +1749,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     public void onCompletion(QueryHandle handle) {
       synchronized (this) {
         succeeded = true;
-        LOG.info("Query " + handle + " with time out succeeded");
+        log.info("Query " + handle + " with time out succeeded");
         this.notify();
       }
     }
@@ -1765,7 +1764,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     public void onError(QueryHandle handle, String error) {
       synchronized (this) {
         succeeded = false;
-        LOG.info("Query " + handle + " with time out failed");
+        log.info("Query " + handle + " with time out failed");
         this.notify();
       }
     }
@@ -1782,7 +1781,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   public QueryResultSetMetadata getResultSetMetadata(LensSessionHandle sessionHandle, QueryHandle queryHandle)
     throws LensException {
     try {
-      LOG.info("GetResultSetMetadata: " + sessionHandle.toString() + " query: " + queryHandle);
+      log.info("GetResultSetMetadata: " + sessionHandle.toString() + " query: " + queryHandle);
       acquire(sessionHandle);
       LensResultSet resultSet = getResultset(queryHandle);
       if (resultSet != null) {
@@ -1806,7 +1805,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   public QueryResult fetchResultSet(LensSessionHandle sessionHandle, QueryHandle queryHandle, long startIndex,
     int fetchSize) throws LensException {
     try {
-      LOG.info("FetchResultSet:" + sessionHandle.toString() + " query:" + queryHandle);
+      log.info("FetchResultSet:" + sessionHandle.toString() + " query:" + queryHandle);
       acquire(sessionHandle);
       return getResultset(queryHandle).toQueryResult();
     } finally {
@@ -1823,7 +1822,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   @Override
   public void closeResultSet(LensSessionHandle sessionHandle, QueryHandle queryHandle) throws LensException {
     try {
-      LOG.info("CloseResultSet:" + sessionHandle.toString() + " query: " + queryHandle);
+      log.info("CloseResultSet:" + sessionHandle.toString() + " query: " + queryHandle);
       acquire(sessionHandle);
       resultSets.remove(queryHandle);
       // Ask driver to close result set
@@ -1842,7 +1841,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   @Override
   public boolean cancelQuery(LensSessionHandle sessionHandle, QueryHandle queryHandle) throws LensException {
     try {
-      LOG.info("CancelQuery: " + sessionHandle.toString() + " query:" + queryHandle);
+      log.info("CancelQuery: " + sessionHandle.toString() + " query:" + queryHandle);
       acquire(sessionHandle);
       QueryContext ctx = getQueryContext(sessionHandle, queryHandle);
       if (ctx.getStatus().finished()) {
@@ -1914,7 +1913,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
         List<QueryHandle> persistedQueries = lensServerDao.findFinishedQueries(state, userName, queryName, fromDate,
           toDate);
         if (persistedQueries != null && !persistedQueries.isEmpty()) {
-          LOG.info("Adding persisted queries " + persistedQueries.size());
+          log.info("Adding persisted queries " + persistedQueries.size());
           all.addAll(persistedQueries);
         }
       }
@@ -1991,7 +1990,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   @Override
   public boolean destroyPrepared(LensSessionHandle sessionHandle, QueryPrepareHandle prepared) throws LensException {
     try {
-      LOG.info("DestroyPrepared: " + sessionHandle.toString() + " query:" + prepared);
+      log.info("DestroyPrepared: " + sessionHandle.toString() + " query:" + prepared);
       acquire(sessionHandle);
       destroyPreparedQuery(getPreparedQueryContext(sessionHandle, prepared));
       return true;
@@ -2025,7 +2024,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   public QueryCost estimate(LensSessionHandle sessionHandle, String query, LensConf lensConf)
     throws LensException {
     try {
-      LOG.info("Estimate: " + sessionHandle.toString() + " query:" + query);
+      log.info("Estimate: " + sessionHandle.toString() + " query:" + query);
       acquire(sessionHandle);
       Configuration qconf = getLensConf(sessionHandle, lensConf);
       ExplainQueryContext estimateQueryContext = new ExplainQueryContext(query,
@@ -2048,7 +2047,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   @Override
   public QueryPlan explain(LensSessionHandle sessionHandle, String query, LensConf lensConf) throws LensException {
     try {
-      LOG.info("Explain: " + sessionHandle.toString() + " query:" + query);
+      log.info("Explain: " + sessionHandle.toString() + " query:" + query);
       acquire(sessionHandle);
       Configuration qconf = getLensConf(sessionHandle, lensConf);
       ExplainQueryContext explainQueryContext = new ExplainQueryContext(query,
@@ -2059,7 +2058,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       addSessionResourcesToDriver(explainQueryContext);
       return explainQueryContext.getSelectedDriver().explain(explainQueryContext).toQueryPlan();
     } catch (LensException e) {
-      LOG.error("Error during explain :", e);
+      log.error("Error during explain :", e);
       QueryPlan plan;
       if (e.getCause() != null && e.getCause().getMessage() != null) {
         plan = new QueryPlan(true, e.getCause().getMessage());
@@ -2135,10 +2134,10 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
             driver = (LensDriver) driverCls.newInstance();
             driver.configure(conf);
           } catch (Exception e) {
-            LOG.error("Could not instantiate driver:" + driverClsName);
+            log.error("Could not instantiate driver:" + driverClsName, e);
             throw new IOException(e);
           }
-          LOG.info("Driver state for " + driverClsName + " will be ignored");
+          log.info("Driver state for " + driverClsName + " will be ignored");
         }
         driver.readExternal(in);
       }
@@ -2187,7 +2186,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
           allQueries.remove(ctx.getQueryHandle());
         }
       }
-      LOG.info("Recovered " + allQueries.size() + " queries");
+      log.info("Recovered " + allQueries.size() + " queries");
     }
   }
 
@@ -2219,7 +2218,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
         }
       }
     }
-    LOG.info("Persisted " + allQueries.size() + " queries");
+    log.info("Persisted " + allQueries.size() + " queries");
   }
 
   /**
@@ -2256,7 +2255,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
           throw new NotFoundException("Http result not available for query:" + queryHandle.toString());
         }
       } catch (IOException e) {
-        LOG.warn("Unable to get status for Result Directory", e);
+        log.warn("Unable to get status for Result Directory", e);
         throw new NotFoundException("Http result not available for query:" + queryHandle.toString());
       }
       String resultFSReadUrl = ctx.getConf().get(LensConfConstants.RESULT_FS_READ_URL);
@@ -2360,7 +2359,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     String lensSession = sessionStarted.getLensSessionID();
     LensSessionHandle sessionHandle = getSessionHandle(lensSession);
     if (sessionHandle == null) {
-      LOG.warn("Lens session went away for sessionid:" + lensSession);
+      log.warn("Lens session went away for sessionid:" + lensSession);
       return;
     }
 
@@ -2371,22 +2370,22 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       List<ResourceEntry> resources = session.getLensSessionPersistInfo().getResources();
       if (resources != null && !resources.isEmpty()) {
         for (ResourceEntry resource : resources) {
-          LOG.info("Restoring resource " + resource + " for session " + lensSession);
+          log.info("Restoring resource " + resource + " for session " + lensSession);
           String command = "add " + resource.getType().toLowerCase() + " " + resource.getLocation();
           try {
             // Execute add resource query in blocking mode
             hiveDriver.execute(createResourceQuery(command, sessionHandle, hiveDriver));
             resource.restoredResource();
-            LOG.info("Restored resource " + resource + " for session " + lensSession);
+            log.info("Restored resource " + resource + " for session " + lensSession);
           } catch (Exception exc) {
-            LOG.error("Unable to add resource " + resource + " for session " + lensSession, exc);
+            log.error("Unable to add resource " + resource + " for session " + lensSession, exc);
           }
         }
       } else {
-        LOG.info("No resources to restore for session " + lensSession);
+        log.info("No resources to restore for session " + lensSession);
       }
     } catch (Exception e) {
-      LOG.warn(
+      log.warn(
         "Lens session went away! " + lensSession + " driver session: "
           + ((DriverSessionStarted) event).getDriverSessionID(), e);
     } finally {
@@ -2421,7 +2420,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       Collection<ResourceEntry> dbResources = session.getDBResources(ctx.getDatabase());
 
       if (CollectionUtils.isNotEmpty(dbResources)) {
-        LOG.info("Proceeding to add resources for DB "
+        log.info("Proceeding to add resources for DB "
           + session.getCurrentDatabase() + " for query " + ctx.getLogHandle() + " resources: " + dbResources);
 
         List<ResourceEntry> failedDBResources = addResources(dbResources, sessionHandle, hiveDriver);
@@ -2433,7 +2432,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
           }
         }
       } else {
-        LOG.info("No need to add DB resources for session: " + sessionIdentifier
+        log.info("No need to add DB resources for session: " + sessionIdentifier
           + " db= " + session.getCurrentDatabase());
       }
       hiveDriver.setResourcesAddedForSession(sessionIdentifier, ctx.getDatabase());
@@ -2442,7 +2441,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     // Get pending session resources which needed to be added for this database
     Collection<ResourceEntry> pendingResources =
       session.getPendingSessionResourcesForDatabase(ctx.getDatabase());
-    LOG.info("Adding pending " + pendingResources.size() + " session resources for session " + sessionIdentifier
+    log.info("Adding pending " + pendingResources.size() + " session resources for session " + sessionIdentifier
       + " for database " + ctx.getDatabase());
     List<ResourceEntry> failedResources = addResources(pendingResources, sessionHandle, hiveDriver);
     // Mark added resources so that we don't add them again. If any of the resources failed
@@ -2471,7 +2470,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
         addSingleResourceToHive(hiveDriver, res, sessionHandle);
       } catch (LensException exc) {
         failedResources.add(res);
-        LOG.error("Error adding resources for session "
+        log.error("Error adding resources for session "
           + sessionHandle.getPublicId().toString() + " resources: " + res.getLocation(), exc.getCause());
       }
     }
@@ -2489,7 +2488,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     }
     String command = "add " + res.getType().toLowerCase() + " " + uri;
     driver.execute(createResourceQuery(command, sessionHandle, driver));
-    LOG.info("Added resource to hive driver for session "
+    log.info("Added resource to hive driver for session "
       + sessionIdentifier + " cmd: " + command);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java b/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java
index 9b6d6bc..34e14b6 100644
--- a/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java
+++ b/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java
@@ -42,22 +42,20 @@ import org.apache.lens.server.api.query.QueryExecutionService;
 import org.apache.lens.server.error.UnSupportedQuerySubmitOpException;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
 
 import org.glassfish.jersey.media.multipart.FormDataParam;
 
+import lombok.extern.slf4j.Slf4j;
+
 /**
  * queryapi resource
  * <p/>
  * This provides api for all things query.
  */
+@Slf4j
 @Path("/queryapi")
 public class QueryServiceResource {
 
-  /** The Constant LOG. */
-  public static final Logger LOG = LogManager.getLogger(QueryServiceResource.class);
-
   /** The query server. */
   private QueryExecutionService queryServer;
 
@@ -269,7 +267,7 @@ public class QueryServiceResource {
         }
       }
     } catch (Exception e) {
-      LOG.error("Error canceling queries", e);
+      log.error("Error canceling queries", e);
       failed = true;
     }
     String msgString = (StringUtils.isBlank(state) ? "" : " in state" + state)
@@ -342,7 +340,7 @@ public class QueryServiceResource {
       try {
         sop = SubmitOp.valueOf(operation.toUpperCase());
       } catch (IllegalArgumentException e) {
-        LOG.error("Illegal argument for submitop: " + operation);
+        log.error("Illegal argument for submitop: " + operation, e);
       }
       if (sop == null) {
         throw new BadRequestException("Invalid operation type: " + operation + prepareClue);
@@ -391,7 +389,7 @@ public class QueryServiceResource {
         }
       }
     } catch (Exception e) {
-      LOG.error("Error destroying prepared queries", e);
+      log.error("Error destroying prepared queries", e);
       failed = true;
     }
     String msgString = (StringUtils.isBlank(user) ? "" : " for user " + user);
@@ -637,7 +635,7 @@ public class QueryServiceResource {
       try {
         sop = SubmitOp.valueOf(operation.toUpperCase());
       } catch (IllegalArgumentException e) {
-        LOG.warn("illegal argument for submit operation: " + operation, e);
+        log.warn("illegal argument for submit operation: " + operation, e);
       }
       if (sop == null) {
         throw new BadRequestException("Invalid operation type: " + operation + submitPreparedClue);

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-server/src/main/java/org/apache/lens/server/session/HiveSessionService.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/session/HiveSessionService.java b/lens-server/src/main/java/org/apache/lens/server/session/HiveSessionService.java
index bb0d301..6dc4ea6 100644
--- a/lens-server/src/main/java/org/apache/lens/server/session/HiveSessionService.java
+++ b/lens-server/src/main/java/org/apache/lens/server/session/HiveSessionService.java
@@ -45,8 +45,6 @@ import org.apache.lens.server.query.QueryExecutionServiceImpl;
 import org.apache.lens.server.session.LensSessionImpl.ResourceEntry;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hive.conf.HiveConf;
@@ -61,15 +59,14 @@ import org.apache.hive.service.cli.OperationHandle;
 import lombok.AccessLevel;
 import lombok.Getter;
 
+import lombok.extern.slf4j.Slf4j;
+
 /**
  * The Class HiveSessionService.
  */
+@Slf4j
 public class HiveSessionService extends LensService implements SessionService {
 
-  /** The Constant LOG. */
-  public static final Log LOG = LogFactory.getLog(HiveSessionService.class);
-
-
   /** The restorable sessions. */
   private List<LensSessionImpl.LensSessionPersistInfo> restorableSessions;
 
@@ -103,7 +100,7 @@ public class HiveSessionService extends LensService implements SessionService {
         service.addResource(sessionid, type, path);
         numAdded++;
       } catch (LensException e) {
-        LOG.error("Failed to add resource type:" + type + " path:" + path + " in service:" + service, e);
+        log.error("Failed to add resource type:" + type + " path:" + path + " in service:" + service, e);
         error = true;
         break;
       }
@@ -205,7 +202,7 @@ public class HiveSessionService extends LensService implements SessionService {
                                        Map<String, String> configuration)
     throws LensException {
     LensSessionHandle sessionid = super.openSession(username, password, configuration);
-    LOG.info("Opened session " + sessionid + " for user " + username);
+    log.info("Opened session " + sessionid + " for user " + username);
     notifyEvent(new SessionOpened(System.currentTimeMillis(), sessionid, username));
 
     // Set current database
@@ -213,7 +210,7 @@ public class HiveSessionService extends LensService implements SessionService {
       try {
         if (!Hive.get(getSession(sessionid).getHiveConf()).databaseExists(database)) {
           closeSession(sessionid);
-          LOG.info("Closed session " + sessionid.getPublicId().toString() + " as db " + database + " does not exist");
+          log.info("Closed session " + sessionid.getPublicId().toString() + " as db " + database + " does not exist");
           throw new NotFoundException("Database " + database + " does not exist");
         }
       } catch (Exception e) {
@@ -221,10 +218,10 @@ public class HiveSessionService extends LensService implements SessionService {
           try {
             closeSession(sessionid);
           } catch (LensException e2) {
-            LOG.error("Error closing session " + sessionid.getPublicId().toString(), e2);
+            log.error("Error closing session " + sessionid.getPublicId().toString(), e2);
           }
 
-          LOG.error("Error in checking if database exists " + database, e);
+          log.error("Error in checking if database exists " + database, e);
           throw new LensException("Error in checking if database exists" + database, e);
         } else {
           throw (NotFoundException) e;
@@ -232,7 +229,7 @@ public class HiveSessionService extends LensService implements SessionService {
       }
 
       getSession(sessionid).setCurrentDatabase(database);
-      LOG.info("Set database to " + database + " for session " + sessionid.getPublicId());
+      log.info("Set database to " + database + " for session " + sessionid.getPublicId());
     }
 
     // add auxuiliary jars
@@ -240,7 +237,7 @@ public class HiveSessionService extends LensService implements SessionService {
 
     if (auxJars != null) {
       for (String jar : auxJars) {
-        LOG.info("Adding aux jar:" + jar);
+        log.info("Adding aux jar:" + jar);
         addResourceToAllServices(sessionid, "jar", jar);
       }
     }
@@ -301,7 +298,7 @@ public class HiveSessionService extends LensService implements SessionService {
    * @param addToSession the add to session
    */
   protected void setSessionParameter(LensSessionHandle sessionid, String key, String value, boolean addToSession) {
-    LOG.info("Request to Set param key:" + key + " value:" + value);
+    log.info("Request to Set param key:" + key + " value:" + value);
     String command = "set" + " " + key + "= " + value;
     try {
       acquire(sessionid);
@@ -320,7 +317,7 @@ public class HiveSessionService extends LensService implements SessionService {
       if (addToSession) {
         getSession(sessionid).setConfig(key, value);
       }
-      LOG.info("Set param key:" + key + " value:" + value);
+      log.info("Set param key:" + key + " value:" + value);
     } catch (HiveSQLException e) {
       throw new WebApplicationException(e);
     } finally {
@@ -354,7 +351,7 @@ public class HiveSessionService extends LensService implements SessionService {
 
     // Restore sessions if any
     if (restorableSessions == null || restorableSessions.size() <= 0) {
-      LOG.info("No sessions to restore");
+      log.info("No sessions to restore");
       return;
     }
 
@@ -373,7 +370,7 @@ public class HiveSessionService extends LensService implements SessionService {
           try {
             addResource(sessionHandle, resourceEntry.getType(), resourceEntry.getLocation());
           } catch (Exception e) {
-            LOG.error("Failed to restore resource for session: " + session + " resource: " + resourceEntry);
+            log.error("Failed to restore resource for session: " + session + " resource: " + resourceEntry, e);
           }
         }
 
@@ -382,16 +379,17 @@ public class HiveSessionService extends LensService implements SessionService {
           try {
             setSessionParameter(sessionHandle, cfg.getKey(), cfg.getValue(), false);
           } catch (Exception e) {
-            LOG.error("Error setting parameter " + cfg.getKey() + "=" + cfg.getValue() + " for session: " + session);
+            log.error("Error setting parameter " + cfg.getKey() + "=" + cfg.getValue()
+                    + " for session: " + session, e);
           }
         }
-        LOG.info("Restored session " + persistInfo.getSessionHandle().getPublicId());
+        log.info("Restored session " + persistInfo.getSessionHandle().getPublicId());
         notifyEvent(new SessionRestored(System.currentTimeMillis(), sessionHandle));
       } catch (LensException e) {
         throw new RuntimeException(e);
       }
     }
-    LOG.info("Session service restoed " + restorableSessions.size() + " sessions");
+    log.info("Session service restoed " + restorableSessions.size() + " sessions");
   }
 
   /*
@@ -420,7 +418,7 @@ public class HiveSessionService extends LensService implements SessionService {
       LensSessionImpl session = getSession(sessionHandle);
       session.getLensSessionPersistInfo().writeExternal(out);
     }
-    LOG.info("Session service pesristed " + SESSION_MAP.size() + " sessions");
+    log.info("Session service pesristed " + SESSION_MAP.size() + " sessions");
   }
 
   /*
@@ -439,7 +437,7 @@ public class HiveSessionService extends LensService implements SessionService {
       restorableSessions.add(persistInfo);
       SESSION_MAP.put(persistInfo.getSessionHandle().getPublicId().toString(), persistInfo.getSessionHandle());
     }
-    LOG.info("Session service recovered " + SESSION_MAP.size() + " sessions");
+    log.info("Session service recovered " + SESSION_MAP.size() + " sessions");
   }
 
   /**
@@ -474,7 +472,7 @@ public class HiveSessionService extends LensService implements SessionService {
       try {
         getCliService().closeOperation(op);
       } catch (HiveSQLException e) {
-        LOG.error("Error closing operation " + op.getHandleIdentifier(), e);
+        log.error("Error closing operation " + op.getHandleIdentifier(), e);
       }
     }
   }
@@ -511,13 +509,13 @@ public class HiveSessionService extends LensService implements SessionService {
         try {
           long lastAccessTime = getSession(sessionHandle).getLastAccessTime();
           closeInternal(sessionHandle);
-          LOG.info("Closed inactive session " + sessionHandle.getPublicId() + " last accessed at "
+          log.info("Closed inactive session " + sessionHandle.getPublicId() + " last accessed at "
             + new Date(lastAccessTime));
           notifyEvent(new SessionExpired(System.currentTimeMillis(), sessionHandle));
         } catch (ClientErrorException nfe) {
           // Do nothing
         } catch (LensException e) {
-          LOG.error("Error closing session " + sessionHandle.getPublicId() + " reason " + e.getMessage());
+          log.error("Error closing session " + sessionHandle.getPublicId() + " reason " + e.getMessage(), e);
         }
       }
     }
@@ -532,7 +530,7 @@ public class HiveSessionService extends LensService implements SessionService {
       try {
         runInternal();
       } catch (Exception e) {
-        LOG.warn("Unknown error while checking for inactive sessions - " + e.getMessage());
+        log.warn("Unknown error while checking for inactive sessions - " + e.getMessage());
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-server/src/main/java/org/apache/lens/server/stats/event/query/QueryExecutionStatistics.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/stats/event/query/QueryExecutionStatistics.java b/lens-server/src/main/java/org/apache/lens/server/stats/event/query/QueryExecutionStatistics.java
index 4acf748..020d540 100644
--- a/lens-server/src/main/java/org/apache/lens/server/stats/event/query/QueryExecutionStatistics.java
+++ b/lens-server/src/main/java/org/apache/lens/server/stats/event/query/QueryExecutionStatistics.java
@@ -34,9 +34,13 @@ import org.apache.hadoop.mapred.TextInputFormat;
 import lombok.Getter;
 import lombok.Setter;
 
+import lombok.extern.slf4j.Slf4j;
+
+
 /**
  * Statistics class used to capture query information.
  */
+@Slf4j
 public class QueryExecutionStatistics extends LoggableLensStatistics {
 
   /** The handle. */
@@ -147,7 +151,7 @@ public class QueryExecutionStatistics extends LoggableLensStatistics {
     try {
       table.setInputFormatClass(TextInputFormat.class.getName());
     } catch (HiveException e) {
-      e.printStackTrace();
+      log.error("Encountered hive exception.", e);
     }
     return table;
   }

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/b0783db7/lens-server/src/test/java/org/apache/lens/server/LensTestUtil.java
----------------------------------------------------------------------
diff --git a/lens-server/src/test/java/org/apache/lens/server/LensTestUtil.java b/lens-server/src/test/java/org/apache/lens/server/LensTestUtil.java
index aab9771..c05a2e7 100644
--- a/lens-server/src/test/java/org/apache/lens/server/LensTestUtil.java
+++ b/lens-server/src/test/java/org/apache/lens/server/LensTestUtil.java
@@ -39,6 +39,7 @@ import org.apache.lens.api.response.NoErrorPayload;
 import org.apache.lens.server.api.LensConfConstants;
 
 import org.apache.commons.io.FileUtils;
+
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.metastore.TableType;
 import org.apache.hadoop.hive.metastore.api.Database;
@@ -52,9 +53,12 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
 import org.glassfish.jersey.media.multipart.FormDataMultiPart;
 import org.testng.Assert;
 
+import lombok.extern.slf4j.Slf4j;
+
 /**
  * The Class LensTestUtil.
  */
+@Slf4j
 public final class LensTestUtil {
 
   public static final String DB_WITH_JARS = "test_db_static_jars";
@@ -283,7 +287,7 @@ public final class LensTestUtil {
         FileUtils.copyFile(testJarFile, new File(dbDir, jarOrder[2]));
         FileUtils.copyFile(serdeJarFile, new File(dbDir, jarOrder[3]));
       } catch (FileNotFoundException fnf) {
-        fnf.printStackTrace();
+        log.error("File not found.", fnf);
       }
     }
   }