From 6a6c4a1c6baa36e003a867f4128f8b457004af82 Mon Sep 17 00:00:00 2001 From: Rudy De Busscher Date: Mon, 14 Jun 2021 20:24:43 +0200 Subject: [PATCH] FISH-1296: Show Logger levels in Web Console alphabetical. --- .../common/handlers/LoggingHandlers.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/appserver/admingui/common/src/main/java/org/glassfish/admingui/common/handlers/LoggingHandlers.java b/appserver/admingui/common/src/main/java/org/glassfish/admingui/common/handlers/LoggingHandlers.java index 5f24893c540..55c0c388fc9 100644 --- a/appserver/admingui/common/src/main/java/org/glassfish/admingui/common/handlers/LoggingHandlers.java +++ b/appserver/admingui/common/src/main/java/org/glassfish/admingui/common/handlers/LoggingHandlers.java @@ -57,10 +57,7 @@ import org.glassfish.admingui.common.util.GuiUtil; import org.glassfish.admingui.common.util.RestUtil; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.logging.Level; /** @@ -83,14 +80,16 @@ public LoggingHandlers() { public static void getLoggerLevels(HandlerContext handlerCtx) { Map loggerLevels = (Map) handlerCtx.getInputValue("loggerLevels"); - List result = new ArrayList(); + List> result = new ArrayList<>(); if (loggerLevels != null) { - for(Map.Entry e : loggerLevels.entrySet()){ - Map oneRow = new HashMap(); - oneRow.put("loggerName", e.getKey()); - oneRow.put("level", e.getValue()); - oneRow.put("selected", false); - result.add(oneRow); + List keys = new ArrayList<>(loggerLevels.keySet()); + Collections.sort(keys); + for (String key : keys) { + Map oneRow = new HashMap<>(); + oneRow.put("loggerName", key); + oneRow.put("level", loggerLevels.get(key)); + oneRow.put("selected", false); + result.add(oneRow); } } handlerCtx.setOutputValue("loggerList", result);