1 23 24 package com.sun.enterprise.cli.commands; 25 26 import com.sun.enterprise.cli.framework.*; 27 import java.util.Map ; 28 import java.text.DateFormat ; 29 import java.util.Vector ; 30 import com.sun.appserv.management.ext.logging.LogAnalyzer; 31 32 public class DisplayErrorStatisticsCommand extends GenericCommand 33 { 34 protected void handleReturnValue(Object retVal) 35 { 36 final Map [] errorInfo = (Map [])retVal; 37 38 if (errorInfo.length > 0) 39 { 40 String sTitle = String.format("%1$-39s %2$-9s %3$-8s", 41 getLocalizedString("Timestamp"), 42 getLocalizedString("Severity"), 43 getLocalizedString("Warning")); 44 45 CLILogger.getInstance().printDetailMessage(sTitle); 46 47 CLILogger.getInstance().printDetailMessage("---------------------------------------------------------"); 48 } 49 for (Map errorRecord : errorInfo) 50 { 51 final Long timeStamp = (Long ) errorRecord.get(LogAnalyzer.TIMESTAMP_KEY); 52 final java.util.Date date = new java.util.Date (timeStamp); 53 54 final Integer severeCount = 55 (Integer ) errorRecord.get(LogAnalyzer.SEVERE_COUNT_KEY); 56 final Integer warningCount = 57 (Integer ) errorRecord.get(LogAnalyzer.WARNING_COUNT_KEY); 58 59 final String sDate = (getBooleanOption(TERSE))?timeStamp.toString(): 60 timeStamp.toString()+ 61 "("+DateFormat.getDateTimeInstance().format(date)+")"; 62 63 final String sErrorRecord = String.format("%1$-43s %2$-8s %3$-8s", 64 sDate, severeCount, warningCount); 65 CLILogger.getInstance().printMessage(sErrorRecord); 66 } 67 if (errorInfo.length > 0) 68 { 69 CLILogger.getInstance().printDetailMessage("---------------------------------------------------------"); 70 } 71 } 72 } 73 | Popular Tags |