asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Blow (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Log Message When Applying Logging Level
Date Tue, 21 Mar 2017 02:00:35 GMT
Michael Blow has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1604

Change subject: Log Message When Applying Logging Level
......................................................................

Log Message When Applying Logging Level

Log a message when resetting the log level, to indicate when the loggers
are being configured and with what level

Change-Id: I38d939a464cc4ea0e5ec9cca88838f083677cf5e
---
M asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
M asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
M asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/AppContextInfo.java
M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java
6 files changed, 33 insertions(+), 6 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/04/1604/1

diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
index 183a0ed..a0b4a2a 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
@@ -165,9 +165,6 @@
 
     @Override
     public void initialize(boolean initialRun) throws IOException, ACIDException {
-        Logger.getLogger("org.apache.asterix").setLevel(externalProperties.getLogLevel());
-        Logger.getLogger("org.apache.hyracks").setLevel(externalProperties.getLogLevel());
-
         ioManager = ncServiceContext.getIoManager();
         threadExecutor = new ThreadExecutor(ncServiceContext.getThreadFactory());
         fileMapManager = new FileMapManager(ioManager);
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
index fcc6f1f..55de9c7 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
@@ -106,6 +106,8 @@
         ICCMessageBroker messageBroker = new CCMessageBroker(controllerService);
         this.ccServiceCtx = (ICCServiceContext) serviceCtx;
 
+        configureLoggingLevel(ccServiceCtx.getAppConfig().getLoggingLevel(ExternalProperties.Option.LOG_LEVEL));
+
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("Starting Asterix cluster controller");
         }
@@ -148,6 +150,13 @@
         jobCapacityController = new JobCapacityController(controllerService.getResourceManager());
     }
 
+    @Override
+    protected void configureLoggingLevel(Level level) {
+        super.configureLoggingLevel(level);
+        LOGGER.info("Setting Asterix log level to " + level);
+        Logger.getLogger("org.apache.asterix").setLevel(level);
+    }
+
     protected List<AsterixExtension> getExtensions() {
         return AppContextInfo.INSTANCE.getExtensionProperties().getExtensions();
     }
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java
index aac7bc3..aaf3d7a 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java
@@ -31,6 +31,7 @@
 import org.apache.asterix.common.api.IAppRuntimeContext;
 import org.apache.asterix.common.config.AsterixExtension;
 import org.apache.asterix.common.config.ClusterProperties;
+import org.apache.asterix.common.config.ExternalProperties;
 import org.apache.asterix.common.config.IPropertiesProvider;
 import org.apache.asterix.common.config.MessagingProperties;
 import org.apache.asterix.common.config.MetadataProperties;
@@ -83,6 +84,7 @@
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("Starting Asterix node controller: " + nodeId);
         }
+        configureLoggingLevel(ncServiceCtx.getAppConfig().getLoggingLevel(ExternalProperties.Option.LOG_LEVEL));
 
         final NodeControllerService controllerService = (NodeControllerService) ncServiceCtx.getControllerService();
 
@@ -124,6 +126,12 @@
         performLocalCleanUp();
     }
 
+    @Override
+    protected void configureLoggingLevel(Level level) {
+        super.configureLoggingLevel(level);
+        Logger.getLogger("org.apache.asterix").setLevel(level);
+    }
+
     protected List<AsterixExtension> getExtensions() {
         return Collections.emptyList();
     }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/AppContextInfo.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/AppContextInfo.java
index 4185b26..ad510e4 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/AppContextInfo.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/AppContextInfo.java
@@ -110,9 +110,6 @@
         INSTANCE.nodeProperties = new NodeProperties(propertiesAccessor);
         INSTANCE.metadataBootstrapSupplier = metadataBootstrapSupplier;
         INSTANCE.globalRecoveryManager = globalRecoveryManager;
-
-        Logger.getLogger("org.apache.asterix").setLevel(INSTANCE.externalProperties.getLogLevel());
-        Logger.getLogger("org.apache.hyracks").setLevel(INSTANCE.externalProperties.getLogLevel());
     }
 
     public boolean initialized() {
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
index 8e423b8..b94cf01 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
@@ -19,6 +19,8 @@
 package org.apache.hyracks.control.cc;
 
 import java.util.Arrays;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.hyracks.api.application.ICCApplication;
 import org.apache.hyracks.api.application.IServiceContext;
@@ -31,6 +33,7 @@
 import org.apache.hyracks.control.common.controllers.NCConfig;
 
 public class BaseCCApplication implements ICCApplication {
+    private static final Logger LOGGER = Logger.getLogger(BaseCCApplication.class.getName());
     public static final ICCApplication INSTANCE = new BaseCCApplication();
 
     protected BaseCCApplication() {
@@ -70,4 +73,10 @@
     public Object getApplicationContext() {
         return null;
     }
+
+    protected void configureLoggingLevel(Level level) {
+        LOGGER.info("Setting Hyracks log level to " + level);
+        Logger.getLogger("org.apache.hyracks").setLevel(level);
+    }
+
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java
index 4a5805e..baf69d0 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java
@@ -20,6 +20,8 @@
 
 import java.lang.management.ManagementFactory;
 import java.util.Arrays;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.hyracks.api.application.INCApplication;
 import org.apache.hyracks.api.application.IServiceContext;
@@ -76,4 +78,9 @@
     public Object getApplicationContext() {
         return null;
     }
+
+    protected void configureLoggingLevel(Level level) {
+        Logger.getLogger("org.apache.hyracks").setLevel(level);
+    }
+
 }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1604
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38d939a464cc4ea0e5ec9cca88838f083677cf5e
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mblow@apache.org>

Mime
View raw message