public abstract class DateLayout extends Layout
限定符和类型 | 字段和说明 |
---|---|
protected java.util.Date |
date |
static java.lang.String |
DATE_FORMAT_OPTION
已过时。
Options are now handled using the JavaBeans paradigm.
This constant is not longer needed and will be removed in the
near term.
|
protected java.text.DateFormat |
dateFormat |
static java.lang.String |
NULL_DATE_FORMAT
String constant designating no time information.
|
protected java.text.FieldPosition |
pos |
static java.lang.String |
RELATIVE_TIME_DATE_FORMAT
String constant designating relative time.
|
static java.lang.String |
TIMEZONE_OPTION
已过时。
Options are now handled using the JavaBeans paradigm.
This constant is not longer needed and will be removed in the
near term.
|
LINE_SEP, LINE_SEP_LEN
构造器和说明 |
---|
DateLayout() |
限定符和类型 | 方法和说明 |
---|---|
void |
activateOptions()
Activate the options that were previously set with calls to option
setters.
|
void |
dateFormat(java.lang.StringBuffer buf,
LoggingEvent event) |
java.lang.String |
getDateFormat()
Returns value of the DateFormat option.
|
java.lang.String[] |
getOptionStrings()
已过时。
Use the setter method for the option directly instead
of the generic
setOption method. |
java.lang.String |
getTimeZone()
Returns value of the TimeZone option.
|
void |
setDateFormat(java.text.DateFormat dateFormat,
java.util.TimeZone timeZone)
Sets the
DateFormat used to format time and date in the
zone determined by timeZone . |
void |
setDateFormat(java.lang.String dateFormat)
The value of the DateFormat option should be either an
argument to the constructor of
SimpleDateFormat or one of
the srings "NULL", "RELATIVE", "ABSOLUTE", "DATE" or "ISO8601. |
void |
setDateFormat(java.lang.String dateFormatType,
java.util.TimeZone timeZone)
Sets the DateFormat used to format date and time in the time zone
determined by
timeZone parameter. |
void |
setOption(java.lang.String option,
java.lang.String value)
已过时。
Use the setter method for the option directly instead
of the generic
setOption method. |
void |
setTimeZone(java.lang.String timeZone)
The TimeZoneID option is a time zone ID string in the format
expected by the
TimeZone.getTimeZone(java.lang.String) method. |
format, getContentType, getFooter, getHeader, ignoresThrowable
public static final java.lang.String NULL_DATE_FORMAT
public static final java.lang.String RELATIVE_TIME_DATE_FORMAT
protected java.text.FieldPosition pos
public static final java.lang.String DATE_FORMAT_OPTION
public static final java.lang.String TIMEZONE_OPTION
protected java.text.DateFormat dateFormat
protected java.util.Date date
public java.lang.String[] getOptionStrings()
setOption
method.public void setOption(java.lang.String option, java.lang.String value)
setOption
method.public void setDateFormat(java.lang.String dateFormat)
SimpleDateFormat
or one of
the srings "NULL", "RELATIVE", "ABSOLUTE", "DATE" or "ISO8601.public java.lang.String getDateFormat()
public void setTimeZone(java.lang.String timeZone)
TimeZone.getTimeZone(java.lang.String)
method.public java.lang.String getTimeZone()
public void activateOptions()
OptionHandler
This allows to defer activiation of the options until all options have been set. This is required for components which have related options that remain ambigous until all are set.
For example, the FileAppender has the File
and Append
options both of
which are ambigous until the other is also set.
public void dateFormat(java.lang.StringBuffer buf, LoggingEvent event)
public void setDateFormat(java.text.DateFormat dateFormat, java.util.TimeZone timeZone)
DateFormat
used to format time and date in the
zone determined by timeZone
.public void setDateFormat(java.lang.String dateFormatType, java.util.TimeZone timeZone)
timeZone
parameter. The DateFormat
used
will depend on the dateFormatType
.
The recognized types are NULL_DATE_FORMAT
, RELATIVE_TIME_DATE_FORMAT
AbsoluteTimeDateFormat.ABS_TIME_DATE_FORMAT
, AbsoluteTimeDateFormat.DATE_AND_TIME_DATE_FORMAT
and AbsoluteTimeDateFormat.ISO8601_DATE_FORMAT
. If the
dateFormatType
is not one of the above, then the
argument is assumed to be a date pattern for SimpleDateFormat
.