1 18 19 package org.apache.tools.ant.listener; 20 21 import org.apache.tools.ant.DefaultLogger; 22 23 import java.util.Date ; 24 import java.text.DateFormat ; 25 26 29 public class TimestampedLogger extends DefaultLogger { 30 31 34 private static final String SPACER = " - at "; 35 36 37 43 protected String getBuildFailedMessage() { 44 return super.getBuildFailedMessage() + SPACER + getTimestamp(); 45 } 46 47 53 protected String getBuildSuccessfulMessage() { 54 return super.getBuildSuccessfulMessage() + SPACER + getTimestamp(); 55 } 56 57 61 protected String getTimestamp() { 62 Date date = new Date (System.currentTimeMillis()); 63 DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); 64 String finishTime = formatter.format(date); 65 return finishTime; 66 } 67 } 68 | Popular Tags |