FileDocCategorySizeDatePackage
LogFormatter.javaAPI DocGlassfish v2 API4251Fri May 04 22:35:08 BST 2007com.sun.enterprise.tools.upgrade.logging

LogFormatter

public class LogFormatter extends com.sun.enterprise.server.logging.UniformLogFormatter
author : Servesh Singh

Fields Summary
private static List
listenerList
Constructors Summary
Methods Summary
public static voidaddLogMessageListener(LogMessageListener listener)

        listenerList.add(listener);
    
public java.lang.Stringformat(java.util.logging.LogRecord rec)


     
 /*
	StringBuffer buf = new StringBuffer(1000);
	buf.append("[");
	buf.append(rec.getLevel());
	buf.append("|");
	buf.append(getForamtedDate(rec.getMillis()));
	buf.append("|");
	buf.append(rec.getLoggerName( ));
	buf.append("|");
	buf.append("ThreadID="+rec.getThreadID( ));
	buf.append("|");
	buf.append(formatMessage(rec));
    Throwable th = rec.getThrown(); 
    if(th !=null) {    
        buf.append("|");    
        buf.append("\n");
		buf.append("	message: "+th.getMessage());
        StackTraceElement[] st = th.getStackTrace();
        buf.append("\n");
        for(int i =0;i<st.length;i++){
            buf.append("        "+st[i]);
            buf.append("\n");
        }
    }
	buf.append("]");
    buf.append('\n');
	String msg = buf.toString();
 */

        notifyRegisteredListeners(rec.getMessage(),rec);
	return super.format(rec);
    
private voidnotifyRegisteredListeners(java.lang.String msg, java.util.logging.LogRecord record)

	int size = listenerList.size();
	for(int i =0; i<size;i++) {
	    LogMessageListener listener = (LogMessageListener)listenerList.get(i);
	    LogMessageEvent e = new LogMessageEvent("UpgradeTool", msg);
         e.setLogRecord(record);
	    listener.logMessageReceived(e);
	}
    
public static voidremoveLogMessageListener(LogMessageListener listener)

	listenerList.remove(listener);