Set the logging level _after_ the application has had a chance to set mkws_config.
authorMike Taylor <mike@indexdata.com>
Thu, 20 Nov 2014 16:09:01 +0000 (16:09 +0000)
committerMike Taylor <mike@indexdata.com>
Thu, 20 Nov 2014 16:09:01 +0000 (16:09 +0000)
src/mkws-core.js

index 2b25807..176e6d7 100644 (file)
@@ -111,8 +111,7 @@ mkws.stringToLevel = function(s) {
 
 mkws.logger = JL('mkws');
 var consoleAppender = JL.createConsoleAppender('consoleAppender');
-mkws.logger.setOptions({ "appenders": [consoleAppender],
-                         "level": mkws.stringToLevel(mkws.log_level) });
+mkws.logger.setOptions({ "appenders": [consoleAppender] });
 
 
 function _log(fn, string) {
@@ -178,7 +177,10 @@ mkws.promotionFunction = function(name) {
 mkws.setMkwsConfig = function(overrides) {
   // Set global log_level flag early so that _log() works
   var tmp = overrides.log_level;
-  if (typeof(tmp) !== 'undefined') mkws.log_level = tmp;
+  if (typeof(tmp) !== 'undefined') {
+    console.log("setting level to '" + tmp + "'");
+    mkws.logger.setOptions({ "level": mkws.stringToLevel(tmp) });
+  }
 
   var config_default = {
     use_service_proxy: true,