public abstract class DateLayout extends Layout
Modifier and Type | Field and Description |
---|---|
protected Date |
date |
static String |
DATE_FORMAT_OPTION
Deprecated.
Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be
removed in the near term.
|
protected DateFormat |
dateFormat |
static String |
NULL_DATE_FORMAT
String constant designating no time information.
|
protected FieldPosition |
pos |
static String |
RELATIVE_TIME_DATE_FORMAT
String constant designating relative time.
|
static String |
TIMEZONE_OPTION
Deprecated.
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
Constructor and Description |
---|
DateLayout() |
Modifier and Type | Method and Description |
---|---|
void |
activateOptions() |
void |
dateFormat(StringBuffer buf,
LoggingEvent event) |
String |
getDateFormat()
Returns value of the DateFormat option.
|
String[] |
getOptionStrings()
Deprecated.
Use the setter method for the option directly instead of the generic
setOption method. |
String |
getTimeZone()
Returns value of the TimeZone option.
|
void |
setDateFormat(DateFormat dateFormat,
TimeZone timeZone)
Sets the
DateFormat used to format time and date in the zone determined by timeZone . |
void |
setDateFormat(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(String dateFormatType,
TimeZone timeZone)
Sets the DateFormat used to format date and time in the time zone determined by
timeZone parameter. |
void |
setOption(String option,
String value)
Deprecated.
Use the setter method for the option directly instead of the generic
setOption method. |
void |
setTimeZone(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 String NULL_DATE_FORMAT
public static final String RELATIVE_TIME_DATE_FORMAT
@Deprecated public static final String DATE_FORMAT_OPTION
@Deprecated public static final String TIMEZONE_OPTION
protected FieldPosition pos
protected DateFormat dateFormat
protected Date date
public void activateOptions()
public void dateFormat(StringBuffer buf, LoggingEvent event)
public String getDateFormat()
@Deprecated public String[] getOptionStrings()
setOption
method.public String getTimeZone()
public void setDateFormat(DateFormat dateFormat, TimeZone timeZone)
DateFormat
used to format time and date in the zone determined by timeZone
.public void setDateFormat(String dateFormat)
SimpleDateFormat
or one of the srings "NULL", "RELATIVE", "ABSOLUTE", "DATE" or "ISO8601.public void setDateFormat(String dateFormatType, 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
.
@Deprecated public void setOption(String option, String value)
setOption
method.public void setTimeZone(String timeZone)
TimeZone.getTimeZone(java.lang.String)
method.Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.