FileDocCategorySizeDatePackage
DisplayErrorStatisticsCommand.javaAPI DocGlassfish v2 API4114Fri May 04 22:25:10 BST 2007com.sun.enterprise.cli.commands

DisplayErrorStatisticsCommand

public class DisplayErrorStatisticsCommand extends BaseLoggingCommand

Fields Summary
Constructors Summary
Methods Summary
protected voidhandleReturnValue(java.lang.Object retVal)

        final Map[] errorInfo = (Map[])retVal;
        
        if (errorInfo.length > 0)
        {
            String sTitle = String.format("%1$-39s %2$-9s %3$-8s",
                                          getLocalizedString("Timestamp"),
                                          getLocalizedString("Severity"),
                                          getLocalizedString("Warning"));
            
            CLILogger.getInstance().printDetailMessage(sTitle);
            
            CLILogger.getInstance().printDetailMessage("---------------------------------------------------------");
        }
        for (Map errorRecord : errorInfo)
        {
            final Long timeStamp = (Long) errorRecord.get(LogAnalyzer.TIMESTAMP_KEY);
            final java.util.Date date = new java.util.Date(timeStamp);

            final Integer severeCount = 
                    (Integer) errorRecord.get(LogAnalyzer.SEVERE_COUNT_KEY);
            final Integer warningCount = 
                    (Integer) errorRecord.get(LogAnalyzer.WARNING_COUNT_KEY);

            final String sDate = (getBooleanOption(TERSE))?timeStamp.toString():
                                 timeStamp.toString()+
                                 "("+DateFormat.getDateTimeInstance().format(date)+")";

            final String sErrorRecord = String.format("%1$-43s %2$-8s %3$-8s", sDate, 
                                                    (severeCount.intValue()<0)?"NA":severeCount, 
                                                    (warningCount.intValue()<0)?"NA":warningCount);
            CLILogger.getInstance().printMessage(sErrorRecord);
        }
        if (errorInfo.length > 0)
        {
            CLILogger.getInstance().printDetailMessage("---------------------------------------------------------");
        }