Reduced logging

Change-Id: I3a3756427999c4b79a01cd5a9cbfe79adf44b95b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1204
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index 5a45dd1..c196ecc 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -2558,7 +2558,9 @@
                 sessionConfig.out().flush();
                 return;
             } else if (sessionConfig.isExecuteQuery() && compiled != null) {
-                GlobalConfig.ASTERIX_LOGGER.info(compiled.toJSON().toString(1));
+                if (GlobalConfig.ASTERIX_LOGGER.isLoggable(Level.FINE)) {
+                    GlobalConfig.ASTERIX_LOGGER.fine(compiled.toJSON().toString(1));
+                }
                 JobId jobId = JobUtils.runJob(hcc, compiled, false);
 
                 JSONObject response = new JSONObject();
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java
index 4d72576..6de9969 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java
@@ -82,7 +82,7 @@
         runOptimizationSets(plan, logicalRewrites);
         computeSchemaBottomUpForPlan(plan);
         runPhysicalOptimizations(plan, physicalRewrites);
-        logPlanAt("Optimized Plan", Level.INFO);
+        logPlanAt("Optimized Plan", Level.FINE);
     }
 
     private void logPlanAt(String name, Level lvl) throws AlgebricksException {
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java
index 7d90a8b..4713aa6 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java
@@ -62,6 +62,8 @@
 
     protected boolean flushRequest;
 
+    private Level openCloseLevel = Level.FINE;
+
     public MaterializingPipelinedPartition(IHyracksTaskContext ctx, PartitionManager manager, PartitionId pid,
             TaskAttemptId taId, Executor executor) {
         this.ctx = ctx;
@@ -159,8 +161,8 @@
 
     @Override
     public void open() throws HyracksDataException {
-        if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("open(" + pid + " by " + taId);
+        if (LOGGER.isLoggable(openCloseLevel)) {
+            LOGGER.log(openCloseLevel, "open(" + pid + " by " + taId);
         }
         size = 0;
         eos = false;
@@ -191,8 +193,8 @@
 
     @Override
     public void close() throws HyracksDataException {
-        if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("close(" + pid + " by " + taId);
+        if (LOGGER.isLoggable(openCloseLevel)) {
+            LOGGER.log(openCloseLevel, "close(" + pid + " by " + taId);
         }
         synchronized (this) {
             eos = true;
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
index 1b75f94..28ba981 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
@@ -74,6 +74,7 @@
     private final Queue<BufferCacheHeaderHelper> headerPageCache = new ConcurrentLinkedQueue<>();
 
     //DEBUG
+    private Level fileOpsLevel = Level.FINE;
     private ArrayList<CachedPage> confiscatedPages;
     private Lock confiscateLock;
     private HashMap<CachedPage, StackTraceElement[]> confiscatedPagesOwner;
@@ -789,8 +790,8 @@
 
     @Override
     public void createFile(FileReference fileRef) throws HyracksDataException {
-        if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("Creating file: " + fileRef + " in cache: " + this);
+        if (LOGGER.isLoggable(fileOpsLevel)) {
+            LOGGER.log(fileOpsLevel, "Creating file: " + fileRef + " in cache: " + this);
         }
         synchronized (fileInfoMap) {
             fileMapManager.registerFile(fileRef);
@@ -799,8 +800,8 @@
 
     @Override
     public int createMemFile() throws HyracksDataException {
-        if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("Creating memory file in cache: " + this);
+        if (LOGGER.isLoggable(fileOpsLevel)) {
+            LOGGER.log(fileOpsLevel, "Creating memory file in cache: " + this);
         }
         int fileId;
         synchronized (fileInfoMap) {
@@ -815,8 +816,8 @@
 
     @Override
     public void openFile(int fileId) throws HyracksDataException {
-        if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("Opening file: " + fileId + " in cache: " + this);
+        if (LOGGER.isLoggable(fileOpsLevel)) {
+            LOGGER.log(fileOpsLevel, "Opening file: " + fileId + " in cache: " + this);
         }
         synchronized (fileInfoMap) {
             BufferedFileHandle fInfo;
@@ -916,8 +917,8 @@
 
     @Override
     public void closeFile(int fileId) throws HyracksDataException {
-        if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("Closing file: " + fileId + " in cache: " + this);
+        if (LOGGER.isLoggable(fileOpsLevel)) {
+            LOGGER.log(fileOpsLevel, "Closing file: " + fileId + " in cache: " + this);
         }
         if (LOGGER.isLoggable(Level.FINE)) {
             LOGGER.fine(dumpState());
@@ -932,8 +933,8 @@
                 throw new HyracksDataException("Closed fileId: " + fileId + " more times than it was opened.");
             }
         }
-        if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("Closed file: " + fileId + " in cache: " + this);
+        if (LOGGER.isLoggable(fileOpsLevel)) {
+            LOGGER.log(fileOpsLevel, "Closed file: " + fileId + " in cache: " + this);
         }
     }
 
@@ -954,8 +955,8 @@
 
     @Override
     public synchronized void deleteFile(int fileId, boolean flushDirtyPages) throws HyracksDataException {
-        if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("Deleting file: " + fileId + " in cache: " + this);
+        if (LOGGER.isLoggable(fileOpsLevel)) {
+            LOGGER.log(fileOpsLevel, "Deleting file: " + fileId + " in cache: " + this);
         }
         synchronized (fileInfoMap) {
             sweepAndFlush(fileId, flushDirtyPages);
@@ -997,8 +998,8 @@
     @Override
     public synchronized void deleteMemFile(int fileId) throws HyracksDataException {
         //TODO: possible sanity chcecking here like in above?
-        if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("Deleting memory file: " + fileId + " in cache: " + this);
+        if (LOGGER.isLoggable(fileOpsLevel)) {
+            LOGGER.log(fileOpsLevel, "Deleting memory file: " + fileId + " in cache: " + this);
         }
         synchronized (virtualFiles) {
             virtualFiles.remove(fileId);