Skip to content

Commit

Permalink
Revert "Merge pull request payara#5267 from rdebusscher/FISH-1415"
Browse files Browse the repository at this point in the history
This reverts commit cd24d29

Signed-off-by: JamesHillyard <[email protected]>
  • Loading branch information
JamesHillyard committed Dec 22, 2021
1 parent ad9b00a commit fea62e6
Showing 1 changed file with 37 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* holder.
*/

// Portions Copyright [2016-2021] [Payara Foundation and/or its affiliates]
// Portions Copyright [2016-2019] [Payara Foundation and/or its affiliates]

/*
* InstanceHandler.java
Expand All @@ -48,22 +48,25 @@
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
/**
*
* @author anilam
*/
package org.glassfish.admingui.common.handlers;

import com.sun.jsftemplating.annotation.Handler;
import com.sun.jsftemplating.annotation.HandlerInput;
import com.sun.jsftemplating.annotation.HandlerOutput;
import com.sun.jsftemplating.layout.descriptors.handler.HandlerContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import org.glassfish.admingui.common.util.GuiUtil;
import org.glassfish.admingui.common.util.RestUtil;

import java.util.*;
import java.util.logging.Level;

/**
*
* @author anilam
*/
public class LoggingHandlers {

/** Creates a new instance of InstanceHandler */
Expand All @@ -80,16 +83,14 @@ public LoggingHandlers() {
public static void getLoggerLevels(HandlerContext handlerCtx) {

Map<String, String> loggerLevels = (Map) handlerCtx.getInputValue("loggerLevels");
List<Map<String, Object>> result = new ArrayList<>();
List result = new ArrayList();
if (loggerLevels != null) {
List<String> keys = new ArrayList<>(loggerLevels.keySet());
Collections.sort(keys);
for (String key : keys) {
Map<String, Object> oneRow = new HashMap<>();
oneRow.put("loggerName", key);
oneRow.put("level", loggerLevels.get(key));
oneRow.put("selected", false);
result.add(oneRow);
for(Map.Entry<String,String> e : loggerLevels.entrySet()){
Map oneRow = new HashMap();
oneRow.put("loggerName", e.getKey());
oneRow.put("level", e.getValue());
oneRow.put("selected", false);
result.add(oneRow);
}
}
handlerCtx.setOutputValue("loggerList", result);
Expand Down Expand Up @@ -194,39 +195,35 @@ public static void deleteLoggers(List<Map<String, Object>> allRows, String confi
@HandlerInput(name = "attrs", type = Map.class, required=true),
@HandlerInput(name = "config", type = String.class, required=true)
})

public static void saveLoggingAttributes(HandlerContext handlerCtx) {
Map<String,Object> attrs = (Map<String,Object>) handlerCtx.getInputValue("attrs");
String config = (String)handlerCtx.getInputValue("config");
Map<String, Object> props = new HashMap<>();
try {
StringBuilder data = new StringBuilder();
Map<String, Object> props = new HashMap();
try{
for (Map.Entry<String, Object> e : attrs.entrySet()) {
String key = e.getKey();
if ((key.equals("com.sun.enterprise.server.logging.SyslogHandler.useSystemLogging") ||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.logtoFile") ||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.logtoConsole") ||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.multiLineMode") ||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.rotationOnDateChange") ||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.compressOnRotation") ||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.logStandardStreams") ||
key.equals("fish.payara.enterprise.server.logging.PayaraNotificationFileHandler.logtoFile") ||
key.equals("fish.payara.enterprise.server.logging.PayaraNotificationFileHandler.rotationOnDateChange") ||
key.equals("fish.payara.enterprise.server.logging.PayaraNotificationFileHandler.compressOnRotation"))
String key=e.getKey();
if ((key.equals("com.sun.enterprise.server.logging.SyslogHandler.useSystemLogging")||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.logtoFile") ||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.logtoConsole") ||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.multiLineMode") ||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.rotationOnDateChange" ) ||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.compressOnRotation") ||
key.equals("com.sun.enterprise.server.logging.GFFileHandler.logStandardStreams") ||
key.equals("fish.payara.enterprise.server.logging.PayaraNotificationFileHandler.logtoFile") ||
key.equals("fish.payara.enterprise.server.logging.PayaraNotificationFileHandler.rotationOnDateChange") ||
key.equals("fish.payara.enterprise.server.logging.PayaraNotificationFileHandler.compressOnRotation"))
&& (e.getValue() == null)) {
attrs.put(key, "false");
}
if (data.length() > 0) {
data.append(":");
}
data.append(key).append("='").append(attrs.get(key)).append("'");
props.put("id", key + "='" + attrs.get(key) + "'");
props.put("target", config);
RestUtil.restRequest((String)GuiUtil.getSessionValue("REST_URL") + "/set-log-attributes",
props, "POST", null, false, true);
}
props.put("id", data.toString());
props.put("target", config);
RestUtil.restRequest((String) GuiUtil.getSessionValue("REST_URL") + "/set-log-attributes",
props, "POST", null, false, true);
} catch (Exception ex) {
}catch (Exception ex){
GuiUtil.handleException(handlerCtx, ex);
if (GuiUtil.getLogger().isLoggable(Level.FINE)) {
if (GuiUtil.getLogger().isLoggable(Level.FINE)){
ex.printStackTrace();
}
}
Expand Down

0 comments on commit fea62e6

Please sign in to comment.