diff options
author | Martin Ritchie <ritchiem@apache.org> | 2009-04-13 14:25:42 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2009-04-13 14:25:42 +0000 |
commit | 8dcb2ac07c190fd2b584d1c9b2e4127269ef243a (patch) | |
tree | 881758eaba6ee49611073592fd42fba41edbfed1 | |
parent | 6b1c43afd9171e7b7053956b5656e89a98f14021 (diff) | |
download | qpid-python-8dcb2ac07c190fd2b584d1c9b2e4127269ef243a.tar.gz |
QPID-1790: add new attribute to logging management mbean to indicate available output levels. Update jmx management console to understand String[] attribute value and display contents properly
merged from trunk r762365
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.5-fix@764485 13f79535-47bb-0310-9956-ffa450edef68
3 files changed, 45 insertions, 8 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagement.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagement.java index 79d60a6df0..f723ab206c 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagement.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagement.java @@ -47,6 +47,13 @@ public interface LoggingManagement description = "The log4j xml configuration file LogWatch interval (in seconds). 0 indicates not being checked.") Integer getLog4jLogWatchInterval(); + /** + * Attribute to represent the available log4j logger output levels. + * @return The logging level names. + */ + @MBeanAttribute(name="AvailableLoggerLevels", description = "The values to which log output level can be set.") + String[] getAvailableLoggerLevels(); + //****** log4j runtime operations ****** // diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java index f84cbbd786..cd3f85f8ca 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java @@ -69,7 +69,10 @@ public class LoggingManagementMBean extends AMQManagedObject implements LoggingM private static final Logger _logger = Logger.getLogger(LoggingManagementMBean.class); private String _log4jConfigFileName; private int _log4jLogWatchInterval; - + private static final String[] LEVELS = new String[]{Level.ALL.toString(), Level.TRACE.toString(), + Level.DEBUG.toString(), Level.INFO.toString(), + Level.WARN.toString(), Level.ERROR.toString(), + Level.FATAL.toString(),Level.OFF.toString()}; static TabularType _loggerLevelTabularType; static CompositeType _loggerLevelCompositeType; @@ -108,7 +111,11 @@ public class LoggingManagementMBean extends AMQManagedObject implements LoggingM { return _log4jLogWatchInterval; } - + + public String[] getAvailableLoggerLevels() + { + return LEVELS; + } @SuppressWarnings("unchecked") public synchronized boolean setRuntimeLoggerLevel(String logger, String level) { diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java index 3234503fb5..48efee44d6 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java @@ -509,10 +509,24 @@ public class AttributesTabControl extends TabControl { if (!isSimpleType(attribute.getValue())) { - Composite composite = new Composite(parent, SWT.BORDER); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - ViewUtility.populateCompositeWithData(_toolkit, composite, attribute.getValue()); + if (attribute.getValue() instanceof String[]) + { + String result = new String(""); + for(String val : (String[]) attribute.getValue()){ + result = result.concat(val+ "; "); + } + value = _toolkit.createText(parent, "", textStyle); + + value.setText(result); + value.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); + } + else + { + Composite composite = new Composite(parent, SWT.BORDER); + composite.setLayout(new GridLayout()); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + ViewUtility.populateCompositeWithData(_toolkit, composite, attribute.getValue()); + } } else { @@ -877,7 +891,16 @@ public class AttributesTabControl extends TabControl break; case 1 : // attribute value column if (attribute.getValue() != null) - result = String.valueOf(attribute.getValue()); + if (attribute.getValue() instanceof String[]) + { + for(String val : (String[]) attribute.getValue()){ + result = result.concat(val+ "; "); + } + } + else + { + result = String.valueOf(attribute.getValue()); + } break; default : result = ""; @@ -933,4 +956,4 @@ public class AttributesTabControl extends TabControl return collator.compare(attribtue1.getName(), attribtue2.getName()); } } -}
\ No newline at end of file +} |