incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [3/5] Adding logger level changer plus shell commands.
Date Tue, 25 Feb 2014 13:07:09 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Level.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Level.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Level.java
new file mode 100644
index 0000000..77d3631
--- /dev/null
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Level.java
@@ -0,0 +1,85 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.blur.thrift.generated;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+import java.util.Map;
+import java.util.HashMap;
+import org.apache.blur.thirdparty.thrift_0_9_0.TEnum;
+
+/**
+ * Logging level enum used to change the logging levels at runtime.
+ */
+public enum Level implements org.apache.blur.thirdparty.thrift_0_9_0.TEnum {
+  OFF(0),
+  FATAL(1),
+  ERROR(2),
+  WARN(3),
+  INFO(4),
+  DEBUG(5),
+  TRACE(6),
+  ALL(7);
+
+  private final int value;
+
+  private Level(int value) {
+    this.value = value;
+  }
+
+  /**
+   * Get the integer value of this enum value, as defined in the Thrift IDL.
+   */
+  public int getValue() {
+    return value;
+  }
+
+  /**
+   * Find a the enum type by its integer value, as defined in the Thrift IDL.
+   * @return null if the value is not found.
+   */
+  public static Level findByValue(int value) { 
+    switch (value) {
+      case 0:
+        return OFF;
+      case 1:
+        return FATAL;
+      case 2:
+        return ERROR;
+      case 3:
+        return WARN;
+      case 4:
+        return INFO;
+      case 5:
+        return DEBUG;
+      case 6:
+        return TRACE;
+      case 7:
+        return ALL;
+      default:
+        return null;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/blur-util/src/main/java/org/apache/blur/log/LogImpl.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/log/LogImpl.java b/blur-util/src/main/java/org/apache/blur/log/LogImpl.java
index b086640..879aec6 100644
--- a/blur-util/src/main/java/org/apache/blur/log/LogImpl.java
+++ b/blur-util/src/main/java/org/apache/blur/log/LogImpl.java
@@ -27,73 +27,73 @@ public class LogImpl implements Log {
   }
 
   public void trace(Object message, Object... args) {
-    if (isTraceEnabled()) {
+    if (log.isTraceEnabled()) {
       log.trace(MessageFormat.format(message.toString(), args));
     }
   }
 
   public void trace(Object message, Throwable t, Object... args) {
-    if (isTraceEnabled()) {
+    if (log.isTraceEnabled()) {
       log.trace(MessageFormat.format(message.toString(), args), t);
     }
   }
 
   public void debug(Object message, Object... args) {
-    if (isDebugEnabled()) {
+    if (log.isDebugEnabled()) {
       log.debug(MessageFormat.format(message.toString(), args));
     }
   }
 
   public void debug(Object message, Throwable t, Object... args) {
-    if (isDebugEnabled()) {
+    if (log.isDebugEnabled()) {
       log.debug(MessageFormat.format(message.toString(), args), t);
     }
   }
 
   public void info(Object message, Object... args) {
-    if (isInfoEnabled()) {
+    if (log.isInfoEnabled()) {
       log.info(MessageFormat.format(message.toString(), args));
     }
   }
 
   public void info(Object message, Throwable t, Object... args) {
-    if (isInfoEnabled()) {
+    if (log.isInfoEnabled()) {
       log.info(MessageFormat.format(message.toString(), args), t);
     }
   }
 
   public void warn(Object message, Object... args) {
-    if (isWarnEnabled()) {
+    if (log.isWarnEnabled()) {
       log.warn(MessageFormat.format(message.toString(), args));
     }
   }
 
   public void warn(Object message, Throwable t, Object... args) {
-    if (isWarnEnabled()) {
+    if (log.isWarnEnabled()) {
       log.warn(MessageFormat.format(message.toString(), args), t);
     }
   }
 
   public void error(Object message, Object... args) {
-    if (isErrorEnabled()) {
+    if (log.isErrorEnabled()) {
       log.error(MessageFormat.format(message.toString(), args));
     }
   }
 
   public void error(Object message, Throwable t, Object... args) {
-    if (isErrorEnabled()) {
+    if (log.isErrorEnabled()) {
       log.error(MessageFormat.format(message.toString(), args), t);
     }
   }
 
   public void fatal(Object message, Object... args) {
-    if (isFatalEnabled()) {
+    if (log.isFatalEnabled()) {
       log.fatal(MessageFormat.format(message.toString(), args));
     }
   }
 
   public void fatal(Object message, Throwable t, Object... args) {
-    if (isFatalEnabled()) {
+    if (log.isFatalEnabled()) {
       log.fatal(MessageFormat.format(message.toString(), args), t);
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/distribution/src/main/scripts/interface/Blur.thrift
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/Blur.thrift b/distribution/src/main/scripts/interface/Blur.thrift
index bc92034..c632487 100644
--- a/distribution/src/main/scripts/interface/Blur.thrift
+++ b/distribution/src/main/scripts/interface/Blur.thrift
@@ -812,6 +812,20 @@ struct User {
 }
 
 /**
+ * Logging level enum used to change the logging levels at runtime.
+ */
+enum Level {
+  OFF,
+  FATAL,
+  ERROR,
+  WARN,
+  INFO,
+  DEBUG,
+  TRACE,
+  ALL
+}
+
+/**
  * The Blur service API.  This API is the same for both controller servers as well as 
  * shards servers.  Each of the methods are documented.
  */
@@ -1196,6 +1210,21 @@ service Blur {
    * A way to ping a server to make sure the connection is still valid.
    */
   void ping()
+
+  /**
+   * Changes the logging level for the given instance dynamically at runtime.
+   */
+  void logging(
+    /** the className or Logger Name of the Logger to be changed. */
+    1:string classNameOrLoggerName, 
+    /** the logging level. */
+    2:Level level
+  ) throws (1:BlurException ex)
+
+  /**
+   * Resets the logging for this instance to match the log4j file.  NOTE: This will allow
for dynamically changing to logging file at runtime.
+   */
+  void resetLogging() throws (1:BlurException ex)
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/distribution/src/main/scripts/interface/gen-html/Blur.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-html/Blur.html b/distribution/src/main/scripts/interface/gen-html/Blur.html
index 27248cf..3c0668f 100644
--- a/distribution/src/main/scripts/interface/gen-html/Blur.html
+++ b/distribution/src/main/scripts/interface/gen-html/Blur.html
@@ -24,6 +24,7 @@
 <li><a href="Blur.html#Fn_Blur_fetchRowBatch">fetchRowBatch</a></li>
 <li><a href="Blur.html#Fn_Blur_isInSafeMode">isInSafeMode</a></li>
 <li><a href="Blur.html#Fn_Blur_listSnapshots">listSnapshots</a></li>
+<li><a href="Blur.html#Fn_Blur_logging">logging</a></li>
 <li><a href="Blur.html#Fn_Blur_metrics">metrics</a></li>
 <li><a href="Blur.html#Fn_Blur_mutate">mutate</a></li>
 <li><a href="Blur.html#Fn_Blur_mutateBatch">mutateBatch</a></li>
@@ -36,6 +37,7 @@
 <li><a href="Blur.html#Fn_Blur_recordFrequency">recordFrequency</a></li>
 <li><a href="Blur.html#Fn_Blur_removeSnapshot">removeSnapshot</a></li>
 <li><a href="Blur.html#Fn_Blur_removeTable">removeTable</a></li>
+<li><a href="Blur.html#Fn_Blur_resetLogging">resetLogging</a></li>
 <li><a href="Blur.html#Fn_Blur_schema">schema</a></li>
 <li><a href="Blur.html#Fn_Blur_setUser">setUser</a></li>
 <li><a href="Blur.html#Fn_Blur_shardClusterList">shardClusterList</a></li>
@@ -67,6 +69,7 @@
 <a href="Blur.html#Struct_FetchResult">FetchResult</a><br/>
 <a href="Blur.html#Struct_FetchRowResult">FetchRowResult</a><br/>
 <a href="Blur.html#Struct_HighlightOptions">HighlightOptions</a><br/>
+<a href="Blur.html#Enum_Level">Level</a><br/>
 <a href="Blur.html#Struct_Metric">Metric</a><br/>
 <a href="Blur.html#Struct_Query">Query</a><br/>
 <a href="Blur.html#Enum_QueryState">QueryState</a><br/>
@@ -186,6 +189,18 @@
 <tr><td><code>CLOSED</code></td><td><code>4</code></td></tr>
 <tr><td><code>CLOSING_ERROR</code></td><td><code>5</code></td></tr>
 </table></div>
+<div class="definition"><h3 id="Enum_Level">Enumeration: Level</h3>
+Logging level enum used to change the logging levels at runtime.
+<br/><br/><table class="table-bordered table-striped table-condensed">
+<tr><td><code>OFF</code></td><td><code>0</code></td></tr>
+<tr><td><code>FATAL</code></td><td><code>1</code></td></tr>
+<tr><td><code>ERROR</code></td><td><code>2</code></td></tr>
+<tr><td><code>WARN</code></td><td><code>3</code></td></tr>
+<tr><td><code>INFO</code></td><td><code>4</code></td></tr>
+<tr><td><code>DEBUG</code></td><td><code>5</code></td></tr>
+<tr><td><code>TRACE</code></td><td><code>6</code></td></tr>
+<tr><td><code>ALL</code></td><td><code>7</code></td></tr>
+</table></div>
 <hr/><h2 id="Structs">Data structures</h2>
 <div class="definition"><h3 id="Struct_BlurException">Exception: BlurException</h3>
 <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default
value</th></thead>
@@ -912,4 +927,18 @@ the shard given the same situation.
 </table></div><div class="definition"><h4 id="Fn_Blur_ping">Function:
Blur.ping</h4>
 <pre><code>void</code> ping()
 </pre>A way to ping a server to make sure the connection is still valid.
+<br/></div><div class="definition"><h4 id="Fn_Blur_logging">Function:
Blur.logging</h4>
+<pre><code>void</code> logging(<code>string</code> classNameOrLoggerName,
+             <code><a href="Blur.html#Enum_Level">Level</a></code>
level)
+    throws <code><a href="Blur.html#Struct_BlurException">BlurException</a></code>
+</pre>Changes the logging level for the given instance dynamically at runtime.
+<br/><br/><h4 id="Parameters_Blur_logging">Parameters</h4>
+<table class="table-bordered table-striped table-condensed"><thead><th>Name</th><th>Description</th></thead><tr><td>classNameOrLoggerName</td><td>the
className or Logger Name of the Logger to be changed.
+</td></tr>
+<tr><td>level</td><td>the logging level.
+</td></tr>
+</table></div><div class="definition"><h4 id="Fn_Blur_resetLogging">Function:
Blur.resetLogging</h4>
+<pre><code>void</code> resetLogging()
+    throws <code><a href="Blur.html#Struct_BlurException">BlurException</a></code>
+</pre>Resets the logging for this instance to match the log4j file.  NOTE: This will
allow for dynamically changing to logging file at runtime.
 <br/></div></div></body></html>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b726909c/distribution/src/main/scripts/interface/gen-html/index.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-html/index.html b/distribution/src/main/scripts/interface/gen-html/index.html
index 33e3a8d..d11ed9a 100644
--- a/distribution/src/main/scripts/interface/gen-html/index.html
+++ b/distribution/src/main/scripts/interface/gen-html/index.html
@@ -20,6 +20,7 @@
 <li><a href="Blur.html#Fn_Blur_fetchRowBatch">fetchRowBatch</a></li>
 <li><a href="Blur.html#Fn_Blur_isInSafeMode">isInSafeMode</a></li>
 <li><a href="Blur.html#Fn_Blur_listSnapshots">listSnapshots</a></li>
+<li><a href="Blur.html#Fn_Blur_logging">logging</a></li>
 <li><a href="Blur.html#Fn_Blur_metrics">metrics</a></li>
 <li><a href="Blur.html#Fn_Blur_mutate">mutate</a></li>
 <li><a href="Blur.html#Fn_Blur_mutateBatch">mutateBatch</a></li>
@@ -32,6 +33,7 @@
 <li><a href="Blur.html#Fn_Blur_recordFrequency">recordFrequency</a></li>
 <li><a href="Blur.html#Fn_Blur_removeSnapshot">removeSnapshot</a></li>
 <li><a href="Blur.html#Fn_Blur_removeTable">removeTable</a></li>
+<li><a href="Blur.html#Fn_Blur_resetLogging">resetLogging</a></li>
 <li><a href="Blur.html#Fn_Blur_schema">schema</a></li>
 <li><a href="Blur.html#Fn_Blur_setUser">setUser</a></li>
 <li><a href="Blur.html#Fn_Blur_shardClusterList">shardClusterList</a></li>
@@ -63,6 +65,7 @@
 <a href="Blur.html#Struct_FetchResult">FetchResult</a><br/>
 <a href="Blur.html#Struct_FetchRowResult">FetchRowResult</a><br/>
 <a href="Blur.html#Struct_HighlightOptions">HighlightOptions</a><br/>
+<a href="Blur.html#Enum_Level">Level</a><br/>
 <a href="Blur.html#Struct_Metric">Metric</a><br/>
 <a href="Blur.html#Struct_Query">Query</a><br/>
 <a href="Blur.html#Enum_QueryState">QueryState</a><br/>


Mime
View raw message