Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2012-12-07 11:49:11 -0500
committerChristopher Frost2012-12-07 11:49:11 -0500
commit1cff4ddd9994d6a85da6022675425d383c145027 (patch)
tree5e846943a68647ce47ecbef21473267bcf522d73 /org.eclipse.virgo.management.console
parent77efff8767f2236547dbbf81b16f6b44cb0e25c9 (diff)
downloadorg.eclipse.virgo.kernel-1cff4ddd9994d6a85da6022675425d383c145027.tar.gz
org.eclipse.virgo.kernel-1cff4ddd9994d6a85da6022675425d383c145027.tar.xz
org.eclipse.virgo.kernel-1cff4ddd9994d6a85da6022675425d383c145027.zip
391637 - Web admin console logback configuration support
Diffstat (limited to 'org.eclipse.virgo.management.console')
-rw-r--r--org.eclipse.virgo.management.console/src/main/java/org/eclipse/virgo/management/console/ContentServlet.java2
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/js/logging.js137
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/styles/logging.css6
-rw-r--r--org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/LoggingJSTests.java5
4 files changed, 94 insertions, 56 deletions
diff --git a/org.eclipse.virgo.management.console/src/main/java/org/eclipse/virgo/management/console/ContentServlet.java b/org.eclipse.virgo.management.console/src/main/java/org/eclipse/virgo/management/console/ContentServlet.java
index 223504fe..204ef0e0 100644
--- a/org.eclipse.virgo.management.console/src/main/java/org/eclipse/virgo/management/console/ContentServlet.java
+++ b/org.eclipse.virgo.management.console/src/main/java/org/eclipse/virgo/management/console/ContentServlet.java
@@ -189,7 +189,7 @@ public class ContentServlet extends HttpServlet {
this.addIfMbeanPresent(menuItems, "wirings", "osgi.core:version=1.0,type=wiringState,region=*");
this.addIfMbeanPresent(menuItems, "dumps", "org.eclipse.virgo.kernel:type=Medic,name=DumpInspector");
this.addIfMbeanPresent(menuItems, "configurations", "osgi.compendium:service=cm,version=1.3,region=*");
- //this.addIfMbeanPresent(menuItems, "logging", "ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator");
+ this.addIfMbeanPresent(menuItems, "logging", "ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator");
String stringArray = Arrays.toString(menuItems.toArray(new String[menuItems.size()]));
pageContext.put("menuNames", stringArray.substring(1, stringArray.length() - 1));
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/js/logging.js b/org.eclipse.virgo.management.console/src/main/webapp/js/logging.js
index 39b593e1..853de9e0 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/js/logging.js
+++ b/org.eclipse.virgo.management.console/src/main/webapp/js/logging.js
@@ -14,13 +14,10 @@
*/
function pageinit(){
- $.ajax({
- url: util.getHostAndAdminPath() + '/jolokia/read/ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator/LoggerList',
- dataType: 'json',
- success: function (response) {
- loggingHandler = new LoggerList(response.value);
- util.pageReady();
- }
+ util.doQuery('read/ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator/LoggerList', function (response){
+ loggingHandler = new LoggerList(response.value);
+ loggingHandler.renderLoggerList();
+ util.pageReady();
});
}
@@ -32,59 +29,95 @@ var LoggerList = function(loggerList){
self.loggerList = loggerList;
- self.rows = new Array();
-
- $.each(loggerList, function(index, loggerName){
- var row = new Array(loggerName, '', '');
- var td = $('<td />', {'class' : 'logger-update','onClick': 'loggingHandler.update("' + loggerName + '")'});
- row.push(td.text('update'));
- self.rows.push(row);
- });
-
- self.loggerTable = util.makeTable({
- clazz: 'logger-table',
- headers: [{title: 'Name', type: 'alpha'}, {title: 'Level', type: 'alpha'}, {title: 'Effective Level', type: 'alpha'}, {title: 'Update', type: 'alpha'}],
- rows: self.rows,
- hoverable: true,
- sortable: true,
- sortIndex: 0
- });
-
- $('#logging-display').append(self.loggerTable);
-
- self.displayLoggerList = function(){
+ self.renderLoggerList = function(){
+ $('#logging-display').empty();
+
+ var rows = new Array();
+ $.each(loggerList, function(index, loggerName){
+ var row = new Array(loggerName);
+ var td = $('<td />', {'class' : 'logger-update','onClick': 'loggingHandler.displayLoggerInfo("' + loggerName + '")'});
+ row.push(td.text('view/edit'));
+ rows.push(row);
+ });
- };
-
- self.displayLoggerListResult = function(loggerList){
- self.loggerList = loggerList;
+ self.loggerTable = util.makeTable({
+ clazz: 'logger-table',
+ //{title: 'Level', type: 'alpha'}, {title: 'Effective Level', type: 'alpha'},
+ headers: [{title: 'Logger Name', type: 'alpha'}, {title: '', type: 'alpha'}],
+ rows: rows,
+ hoverable: true,
+ sortable: true,
+ sortIndex: 0
+ });
+ $('#logging-display').append(self.loggerTable);
};
- self.update = function(loggerName){
- var name = 'updatelevel' + loggerName;
- var title = 'Update a Logging level';
- var content = $('<div />');
- content.append($('<div />').text('New level for: ' + loggerName));
- content.append($('<input />', {type: 'text'}).text('New level for: ' + loggerName));
-
- var link = $('<div />', {'class': 'button-container'});
-
- var linkButton = $('<div />', {'class': 'button'});
-
- linkButton.append($('<div />', {'class': 'button-cap-left-blue'}));
- linkButton.append($('<div />', {'class': 'button-text'}).text('Submit'));
- linkButton.append($('<div />', {'class': 'button-cap-right-blue'}));
- link.append(linkButton);
- content.append(link);
+ self.displayLoggerInfo = function(loggerName){
+ var request = new Array({
+ "type": "EXEC",
+ "mbean": "ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator",
+ "operation": "getLoggerLevel",
+ "arguments": [loggerName]
+ },{
+ "type": "EXEC",
+ "mbean": "ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator",
+ "operation": "getLoggerEffectiveLevel",
+ "arguments": [loggerName]
+ });
- var infoBox = new InfoBox({name: name, title: title, content: content, closeable: true}).show();
+ var cssLoggerName = loggerName.replace(new RegExp('\\.', 'g'), '_');
- link.click(function(event){
- event.stopPropagation();
- infoBox.hide();
+ util.doBulkQuery(request, function(response) {
+ var name = 'updatelevel-' + cssLoggerName;
+ var title = 'Update a Logging level';
+ var content = $('<div />');
+
+ var tableRows = new Array();
+
+ tableRows.push(['Logger: ', loggerName]);
+ tableRows.push(['Logger Level: ', response[0].value]);
+ tableRows.push(['Effective Logger Level: ', response[1].value]);
+
+ var levelSelector = $('<select />', {id: 'level-selector-' + cssLoggerName, type: 'select'});
+ levelSelector.append($('<option />', {value: 'ERROR'}).text('Error'));
+ levelSelector.append($('<option />', {value: 'WARN'}).text('Warn'));
+ levelSelector.append($('<option />', {value: 'INFO'}).text('Info'));
+ levelSelector.append($('<option />', {value: 'DEBUG'}).text('Debug'));
+ levelSelector.append($('<option />', {value: 'TRACE'}).text('Trace'));
+ tableRows.push(['New Level', levelSelector]);
+
+ var propertiesTable = util.makeTable({
+ clazz: "logger-details-table",
+ headers: [],
+ rows: tableRows
+ });
+
+ content.append(propertiesTable);
+
+ var link = $('<div />', {'class': 'button-container'});
+ var linkButton = $('<div />', {'class': 'button'});
+ linkButton.append($('<div />', {'class': 'button-cap-left-blue'}));
+ linkButton.append($('<div />', {'class': 'button-text'}).text('Submit'));
+ linkButton.append($('<div />', {'class': 'button-cap-right-blue'}));
+ link.append(linkButton);
+ content.append(link);
+
+ var infoBox = new InfoBox({name: name, title: title, content: content, closeable: true}).show();
+
+ link.click({loggerName: loggerName, cssLoggerName: cssLoggerName}, function(event){
+ event.stopPropagation();
+ var newLevel = $('#level-selector-' + event.data.cssLoggerName).val();
+ infoBox.hide();
+ util.doQuery('exec/ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator/setLoggerLevel/' + event.data.loggerName + '/' + newLevel, function (response){
+ self.displayLoggerInfo(event.data.loggerName);
+ });
+ });
+
});
+
+
};
};
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/styles/logging.css b/org.eclipse.virgo.management.console/src/main/webapp/styles/logging.css
index f9478288..0bf21587 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/styles/logging.css
+++ b/org.eclipse.virgo.management.console/src/main/webapp/styles/logging.css
@@ -16,4 +16,10 @@
.table-tr-hovered .logger-update {
color: #666666;
cursor: pointer;
+}
+
+.logger-details-table {
+ margin-bottom: 15px;
+ margin-left: auto;
+ margin-right: auto;
} \ No newline at end of file
diff --git a/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/LoggingJSTests.java b/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/LoggingJSTests.java
index 0ef05f41..689c565f 100644
--- a/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/LoggingJSTests.java
+++ b/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/LoggingJSTests.java
@@ -16,7 +16,6 @@ import java.io.IOException;
import javax.script.ScriptException;
-import org.eclipse.virgo.management.console.stubs.objects.Dollar;
import org.junit.Test;
import sun.org.mozilla.javascript.internal.Context;
@@ -36,9 +35,9 @@ public class LoggingJSTests extends AbstractJSTests {
invokePageInit();
- assertTrue(Dollar.getAjaxUrl().contains("LoggerList"));
+ Function callback = commonUtil.getLastQueryCallBack();
- Dollar.getAjaxSuccess().call(context, scope, scope, new Object[] { getTestLoggers() });
+ callback.call(context, scope, scope, new Object[] { getTestLoggers() });
assertTrue("Page ready has not been called", commonUtil.isPageReady());
}

Back to the top