1 package org.jzonic.jlo.formatter.tokens; 2 3 import org.jzonic.jlo.LogRecord; 4 5 import java.text.SimpleDateFormat ; 6 import java.util.Date ; 7 8 13 public class DateToken implements FormatterToken { 14 15 private String df = "yyyy/MM/dd HH:mm:ss"; 16 17 public String format(LogRecord lr) { 18 SimpleDateFormat formatter = new SimpleDateFormat (df); 19 Date currentTime = new Date (); 20 String dateString = formatter.format(currentTime); 21 return dateString; 22 } 23 24 public String getName() { 25 return "date"; 26 } 27 28 public void setParameterString(String txt) { 29 df = txt; 30 } 31 } 32 | Popular Tags |