changeset 145:53699074fee2

Bug 2847: LogLevel cannot change through JMX. reviewed-by: ykubota GitHub: https://github.com/HeapStats/heapstats/pull/13
author Yasumasa Suenaga <yasuenag@gmail.com>
date Sat, 13 Feb 2016 17:01:02 +0900
parents 196e0cef3002
children 3b4e142bca0f
files ChangeLog agent/src/heapstats-engines/configuration.cpp agent/src/heapstats-engines/configuration.hpp
diffstat 3 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 09 11:33:12 2016 +0900
+++ b/ChangeLog	Sat Feb 13 17:01:02 2016 +0900
@@ -1,3 +1,7 @@
+2016-02-13  Yasumasa Suenaga <yasuenag@gmail.com>
+
+	* Bug2847: LogLevel cannot change through JMX.
+
 2016-02-09  KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp>
 
 	* Bug 2846: Fix typo in ReferenceTree Tab
--- a/agent/src/heapstats-engines/configuration.cpp	Tue Feb 09 11:33:12 2016 +0900
+++ b/agent/src/heapstats-engines/configuration.cpp	Sat Feb 13 17:01:02 2016 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file configuration.cpp
  * \brief This file treats HeapStats configuration.
- * Copyright (C) 2014-2015 Yasumasa Suenaga
+ * Copyright (C) 2014-2016 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -99,7 +99,7 @@
                                             &setOnewayBooleanValue);
     triggerOnLogLock = new TBooleanConfig(this, "trigger_on_loglock", true);
     rankLevel = new TIntConfig(this, "rank_level", 5);
-    logLevel = new TLogLevelConfig(this, "loglevel", INFO);
+    logLevel = new TLogLevelConfig(this, "loglevel", INFO, &setLogLevel);
     order = new TRankOrderConfig(this, "rank_order", DELTA);
     alertPercentage = new TIntConfig(this, "alert_percentage", 50);
     heapAlertPercentage = new TIntConfig(this, "javaheap_alert_percentage", 95);
@@ -770,3 +770,10 @@
 
   return false;
 }
+
+void TConfiguration::setLogLevel(TConfiguration *inst,
+                                 TLogLevel val, TLogLevel *dest) {
+  *dest = val;
+  logger->setLogLevel(val);
+}
+
--- a/agent/src/heapstats-engines/configuration.hpp	Tue Feb 09 11:33:12 2016 +0900
+++ b/agent/src/heapstats-engines/configuration.hpp	Sat Feb 13 17:01:02 2016 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file configuration.hpp
  * \brief This file treats HeapStats configuration.
- * Copyright (C) 2014-2015 Yasumasa Suenaga
+ * Copyright (C) 2014-2016 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -468,6 +468,8 @@
   void initializeConfig(const TConfiguration *src);
 
   /* Setters */
+  static void setLogLevel(TConfiguration *inst, TLogLevel val, TLogLevel *dest);
+
   static void setOnewayBooleanValue(TConfiguration *inst, bool val,
                                     bool *dest) {
     if (inst->isLoaded && !(*dest) && val) {