public abstract class

DateLayout

extends Layout
java.lang.Object
   ↳ org.apache.log4j.Layout
     ↳ org.apache.log4j.helpers.DateLayout
Known Direct Subclasses

Class Overview

This abstract layout takes care of all the date related options and formatting work.

Summary

Constants
String DATE_FORMAT_OPTION This constant is deprecated. Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.
String NULL_DATE_FORMAT String constant designating no time information.
String RELATIVE_TIME_DATE_FORMAT String constant designating relative time.
String TIMEZONE_OPTION This constant is deprecated. Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.
Fields
protected Date date
protected DateFormat dateFormat
protected FieldPosition pos
[Expand]
Inherited Fields
From class org.apache.log4j.Layout
Public Constructors
DateLayout()
Public Methods
void activateOptions()
void dateFormat(StringBuffer buf, LoggingEvent event)
String getDateFormat()
Returns value of the DateFormat option.
String[] getOptionStrings()
This method is 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(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 setDateFormat(DateFormat dateFormat, TimeZone timeZone)
Sets the DateFormat used to format time and date in the zone determined by timeZone.
void setOption(String option, String value)
This method is 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 getTimeZone(String) method.
[Expand]
Inherited Methods
From class org.apache.log4j.Layout
From class java.lang.Object
From interface org.apache.log4j.spi.OptionHandler

Constants

public static final String DATE_FORMAT_OPTION

This constant is deprecated.
Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

Constant Value: "DateFormat"

public static final String NULL_DATE_FORMAT

String constant designating no time information. Current value of this constant is NULL.

Constant Value: "NULL"

public static final String RELATIVE_TIME_DATE_FORMAT

String constant designating relative time. Current value of this constant is RELATIVE.

Constant Value: "RELATIVE"

public static final String TIMEZONE_OPTION

This constant is deprecated.
Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

Constant Value: "TimeZone"

Fields

protected Date date

protected DateFormat dateFormat

protected FieldPosition pos

Public Constructors

public DateLayout ()

Public Methods

public void activateOptions ()

public void dateFormat (StringBuffer buf, LoggingEvent event)

public String getDateFormat ()

Returns value of the DateFormat option.

public String[] getOptionStrings ()

This method is deprecated.
Use the setter method for the option directly instead of the generic setOption method.

public String getTimeZone ()

Returns value of the TimeZone option.

public 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.

public void setDateFormat (String dateFormatType, TimeZone timeZone)

Sets the DateFormat used to format date and time in the time zone determined by timeZone parameter. The DateFormat used will depend on the dateFormatType.

The recognized types are NULL_DATE_FORMAT, RELATIVE_TIME_DATE_FORMAT ABS_TIME_DATE_FORMAT, DATE_AND_TIME_DATE_FORMAT and ISO8601_DATE_FORMAT. If the dateFormatType is not one of the above, then the argument is assumed to be a date pattern for SimpleDateFormat.

public void setDateFormat (DateFormat dateFormat, TimeZone timeZone)

Sets the DateFormat used to format time and date in the zone determined by timeZone.

public void setOption (String option, String value)

This method is deprecated.
Use the setter method for the option directly instead of the generic setOption method.

public void setTimeZone (String timeZone)

The TimeZoneID option is a time zone ID string in the format expected by the getTimeZone(String) method.