You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2010/12/16 10:23:11 UTC
svn commit: r1049837 - in
/sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j:
LogConfigManager.java SlingLogPanel.java
Author: fmeschbe
Date: Thu Dec 16 09:23:10 2010
New Revision: 1049837
URL: http://svn.apache.org/viewvc?rev=1049837&view=rev
Log:
SLING-1898 Adapt output to WebConsule's JQuery UI use and add a status line indicating the number of loggers used, the number of configurations received and the number of log writers active
Modified:
sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/LogConfigManager.java
sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/SlingLogPanel.java
Modified: sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/LogConfigManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/LogConfigManager.java?rev=1049837&r1=1049836&r2=1049837&view=diff
==============================================================================
--- sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/LogConfigManager.java (original)
+++ sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/LogConfigManager.java Thu Dec 16 09:23:10 2010
@@ -210,6 +210,35 @@ public class LogConfigManager implements
* an iterator.
*/
Iterator<SlingLoggerWriter> getSlingLoggerWriters() {
+ return internalGetSlingLoggerWriters().iterator();
+ }
+
+ /**
+ * Returns the number of logger configurations active in the system
+ */
+ int getNumSlingLoggerConfigs() {
+ return configByPid.size();
+ }
+
+ /**
+ * Returns the number of logger writers active in the system
+ */
+ int getNumSlingLogWriters() {
+ return internalGetSlingLoggerWriters().size();
+ }
+
+ /**
+ * Returns the number of currently user logger categories
+ */
+ int getNumLoggers() {
+ return loggersByCategory.size();
+ }
+
+ /**
+ * Internal method returns the collection of explicitly configured and
+ * implicitly defined logger writers.
+ */
+ private Collection<SlingLoggerWriter> internalGetSlingLoggerWriters() {
// configured writers
Collection<SlingLoggerWriter> writers = new HashSet<SlingLoggerWriter>(
writerByPid.values());
@@ -221,7 +250,7 @@ public class LogConfigManager implements
}
}
- return writers.iterator();
+ return writers;
}
// ---------- Configuration support
Modified: sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/SlingLogPanel.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/SlingLogPanel.java?rev=1049837&r1=1049836&r2=1049837&view=diff
==============================================================================
--- sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/SlingLogPanel.java (original)
+++ sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/SlingLogPanel.java Thu Dec 16 09:23:10 2010
@@ -76,14 +76,20 @@ public class SlingLogPanel extends HttpS
final String consoleAppRoot = (String) req.getAttribute("felix.webconsole.appRoot");
final String cfgColTitle = (consoleAppRoot == null) ? "PID" : "Configuration";
+
+ pw.printf(
+ "<p class='statline'>Log Service Stats: %d categories, %d configuration(s), %d writer(s)</p>%n",
+ logConfigManager.getNumLoggers(),
+ logConfigManager.getNumSlingLoggerConfigs(),
+ logConfigManager.getNumSlingLogWriters());
+
pw.println("<div class='table'>");
- pw.println("<h1>Logger</h1>");
+ pw.println("<div class='ui-widget-header ui-corner-top buttonGroup'>Logger</div>");
- pw.println("<table class='tablelayout'>");
+ pw.println("<table class='nicetable ui-widget'>");
- pw.println("<thead>");
- pw.println("</tr>");
+ pw.println("<thead class='ui-widget-header'>");
pw.println("<tr>");
pw.println("<th>Log Level</th>");
pw.println("<th>Log File</th>");
@@ -91,7 +97,7 @@ public class SlingLogPanel extends HttpS
pw.println("<th>" + cfgColTitle + "</th>");
pw.println("</tr>");
pw.println("</thead>");
- pw.println("<tbody>");
+ pw.println("<tbody class='ui-widget-content'>");
Iterator<SlingLoggerConfig> loggers = logConfigManager.getSlingLoggerConfigs();
while (loggers.hasNext()) {
@@ -119,18 +125,18 @@ public class SlingLogPanel extends HttpS
pw.println("<div class='table'>");
- pw.println("<h1>Log Writer</h1>");
+ pw.println("<div class='ui-widget-header ui-corner-top buttonGroup'>Log Writer</div>");
- pw.println("<table class='tablelayout'>");
+ pw.println("<table class='nicetable ui-widget'>");
- pw.println("<thead>");
+ pw.println("<thead class='ui-widget-header'>");
pw.println("<tr>");
pw.println("<th>Log File</th>");
pw.println("<th>Rotator</th>");
pw.println("<th>" + cfgColTitle + "</th>");
pw.println("</tr>");
pw.println("</thead>");
- pw.println("<tbody>");
+ pw.println("<tbody class='ui-widget-content'>");
Iterator<SlingLoggerWriter> writers = logConfigManager.getSlingLoggerWriters();
while (writers.hasNext()) {