Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 14 15 package org.quickserver.util.logging; 16 17 import java.util.Date ; 18 import java.text.SimpleDateFormat ; 19 import java.util.logging.*; 20 import org.quickserver.util.MyString; 21 22 25 public class MiniFormatter extends Formatter { 26 private Date date = new Date (); 27 private SimpleDateFormat df = new SimpleDateFormat ("MMM d, yyyy hh:mm a"); 28 29 private String lineSeparator = (String ) java.security.AccessController.doPrivileged( 30 new sun.security.action.GetPropertyAction("line.separator")); 31 32 33 public synchronized String format(LogRecord record) { 34 date.setTime(record.getMillis()); 35 StringBuffer sb = new StringBuffer (); 36 sb.append(df.format(date)); 37 sb.append(" - "); 38 sb.append(MyString.alignLeft(record.getLevel().getLocalizedName(), 7)); 39 sb.append(" : "); 40 sb.append(formatMessage(record)); 41 if(record.getThrown() != null) { 42 sb.append(lineSeparator); 43 sb.append("[Exception: "); 44 sb.append(record.getThrown().toString()); 45 sb.append(']'); 46 } 47 sb.append(lineSeparator); 48 return sb.toString(); 49 } 50 51 52 } 53
| Popular Tags
|