Package org.apache.log4j.helpers
Class DateLayout
java.lang.Object
org.apache.log4j.Layout
org.apache.log4j.helpers.DateLayout
This abstract layout takes care of all the date related options and formatting work.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Datestatic final StringDeprecated.Options are now handled using the JavaBeans paradigm.protected DateFormatprivate Stringstatic final StringString constant designating no time information.protected FieldPositionstatic final StringString constant designating relative time.static final StringDeprecated.Options are now handled using the JavaBeans paradigm.private StringFields inherited from class org.apache.log4j.Layout
LINE_SEP, LINE_SEP_LEN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddateFormat(StringBuffer buf, LoggingEvent event) Returns value of the DateFormat option.String[]Deprecated.Use the setter method for the option directly instead of the genericsetOptionmethod.Returns value of the TimeZone option.voidsetDateFormat(String dateFormat) The value of the DateFormat option should be either an argument to the constructor ofSimpleDateFormator one of the srings "NULL", "RELATIVE", "ABSOLUTE", "DATE" or "ISO8601.voidsetDateFormat(String dateFormatType, TimeZone timeZone) Sets the DateFormat used to format date and time in the time zone determined bytimeZoneparameter.voidsetDateFormat(DateFormat dateFormat, TimeZone timeZone) Sets theDateFormatused to format time and date in the zone determined bytimeZone.voidDeprecated.Use the setter method for the option directly instead of the genericsetOptionmethod.voidsetTimeZone(String timeZone) The TimeZoneID option is a time zone ID string in the format expected by theTimeZone.getTimeZone(java.lang.String)method.Methods inherited from class org.apache.log4j.Layout
format, getContentType, getFooter, getHeader, ignoresThrowable
-
Field Details
-
NULL_DATE_FORMAT
String constant designating no time information. Current value of this constant is NULL.- See Also:
-
RELATIVE_TIME_DATE_FORMAT
String constant designating relative time. Current value of this constant is RELATIVE.- See Also:
-
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.- See Also:
-
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.- See Also:
-
pos
-
timeZoneID
-
dateFormatOption
-
dateFormat
-
date
-
-
Constructor Details
-
DateLayout
public DateLayout()
-
-
Method Details
-
activateOptions
public void activateOptions() -
dateFormat
-
getDateFormat
Returns value of the DateFormat option. -
getOptionStrings
Deprecated.Use the setter method for the option directly instead of the genericsetOptionmethod. -
getTimeZone
Returns value of the TimeZone option. -
setDateFormat
Sets theDateFormatused to format time and date in the zone determined bytimeZone. -
setDateFormat
The value of the DateFormat option should be either an argument to the constructor ofSimpleDateFormator one of the srings "NULL", "RELATIVE", "ABSOLUTE", "DATE" or "ISO8601. -
setDateFormat
Sets the DateFormat used to format date and time in the time zone determined bytimeZoneparameter. TheDateFormatused will depend on thedateFormatType.The recognized types are
NULL_DATE_FORMAT,RELATIVE_TIME_DATE_FORMATAbsoluteTimeDateFormat.ABS_TIME_DATE_FORMAT,AbsoluteTimeDateFormat.DATE_AND_TIME_DATE_FORMATandAbsoluteTimeDateFormat.ISO8601_DATE_FORMAT. If thedateFormatTypeis not one of the above, then the argument is assumed to be a date pattern forSimpleDateFormat. -
setOption
Deprecated.Use the setter method for the option directly instead of the genericsetOptionmethod. -
setTimeZone
The TimeZoneID option is a time zone ID string in the format expected by theTimeZone.getTimeZone(java.lang.String)method.
-