--- org/apache/log4j/HTMLLayout.java Thu Feb 20 02:07:38 2003
+++ HTMLLayout.java Mon Dec 29 13:19:10 2003
@@ -51,6 +51,7 @@
boolean locationInfo = false;
String title = "Log4J Log Messages";
+ String timeStampFormat = null;
/**
The <b>LocationInfo</b> option takes a boolean value. By
@@ -94,6 +95,29 @@
String getTitle() {
return title;
}
+
+ /**
+ The <b>TimeStampFormat</b> option takes a String value. This option sets the
+ pattern in which the time for an event is formatted.
+
+ <p>The pattern should conform to the specification used by
+ <code>java.text.SimpleDateFormat</code>
+
+ <p>Defaults to 'null' in which case the time stamp displayed for the event will
+ be the time in milliseconds since the application was started.
+ */
+ public
+ void setTimeStampFormat(String timeStampFormat) {
+ this.timeStampFormat = timeStampFormat;
+ }
+
+ /**
+ Returns the current value of the <b>TimeStampFormat</b> option.
+ */
+ public
+ String getTimeStampFormat() {
+ return timeStampFormat;
+ }
/**
Returns the content type output by this layout, i.e "text/html".
@@ -122,7 +146,20 @@
sbuf.append(Layout.LINE_SEP + "<tr>" + Layout.LINE_SEP);
sbuf.append("<td>");
- sbuf.append(event.timeStamp - event.getStartTime());
+
+ if (timeStampFormat == null)
+ {
+ sbuf.append(event.timeStamp - event.getStartTime());
+ }
+ else
+ {
+ sbuf.append(
+ new java.text.SimpleDateFormat(timeStampFormat).format(
+ new java.util.Date(event.timeStamp)
+ )
+ );
+ }
+
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("<td title=\"" + event.getThreadName() + " thread\">");
DISCLAIMER:
**This E-mail and any of its attachments may contain Lincoln National Corporation
proprietary information, which is privileged, confidential, or subject to copyright
belonging to the Lincoln National Corporation family of companies. This E-mail is
intended solely for the use of the individual or entity to which it is addressed. If
you are not the intended recipient of this E-mail, you are hereby notified that any
dissemination, distribution, copying, or action taken in relation to the contents of
and attachments to this E-mail is strictly prohibited and may be unlawful. If you have
received this E-mail in error, please notify the sender immediately and permanently
delete the original and any copy of this E-mail and any printout. Thank You.**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]