|
NLOG4J 1.2.24 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.log4j.Layout org.apache.log4j.helpers.DateLayout
public abstract class DateLayout
This abstract layout takes care of all the date related options and formatting work.
Field Summary | |
---|---|
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. |
Fields inherited from class org.apache.log4j.Layout |
---|
LINE_SEP, LINE_SEP_LEN |
Constructor Summary | |
---|---|
DateLayout()
|
Method Summary | |
---|---|
void |
activateOptions()
Activate the options that were previously set with calls to option setters. |
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. |
Methods inherited from class org.apache.log4j.Layout |
---|
format, getContentType, getFooter, getHeader, ignoresThrowable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NULL_DATE_FORMAT
public static final String RELATIVE_TIME_DATE_FORMAT
protected FieldPosition pos
public static final String DATE_FORMAT_OPTION
public static final String TIMEZONE_OPTION
protected DateFormat dateFormat
protected Date date
Constructor Detail |
---|
public DateLayout()
Method Detail |
---|
public String[] getOptionStrings()
setOption
method.
public void setOption(String option, String value)
setOption
method.
public void setDateFormat(String dateFormat)
SimpleDateFormat
or one of
the srings "NULL", "RELATIVE", "ABSOLUTE", "DATE" or "ISO8601.
public String getDateFormat()
public void setTimeZone(String timeZone)
TimeZone.getTimeZone(java.lang.String)
method.
public 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(StringBuffer buf, LoggingEvent event)
public void setDateFormat(DateFormat dateFormat, TimeZone timeZone)
DateFormat
used to format time and date in the
zone determined by timeZone
.
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
.
|
NLOG4J 1.2.24 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |