1 23 package com.sun.enterprise.logging; 24 25 import java.util.logging.SimpleFormatter ; 26 import java.util.logging.LogRecord ; 27 import java.io.StringWriter ; 28 import java.io.PrintWriter ; 29 30 37 public class VerifierFormatter extends SimpleFormatter { 38 39 private String lineSeparator = (String ) java.security.AccessController.doPrivileged( 40 new sun.security.action.GetPropertyAction("line.separator")); 41 42 public synchronized String format(LogRecord record) { 43 StringBuilder sb = new StringBuilder (); 44 StringBuilder text = new StringBuilder (); 45 sb.append(text); 46 sb.append(" "); 47 String message = formatMessage(record); 48 sb.append(record.getLevel().getLocalizedName()); 49 sb.append(": "); 50 sb.append(message); 51 sb.append(lineSeparator); 52 if (record.getThrown() != null) { 53 try { 54 StringWriter sw = new StringWriter (); 55 PrintWriter pw = new PrintWriter (sw); 56 record.getThrown().printStackTrace(pw); 57 pw.close(); 58 sb.append(sw.toString()); 59 } catch (Exception ex) { 60 } 61 } 62 return sb.toString(); 63 } 64 } 65 | Popular Tags |