This may or may not be useful to you, but I am currently working on a log viewer that will enable you to view and search very large files (up to 2,147,483,647 (Integer.MAX_VALUE) lines in length). Part of its functionality allows you to describe the format of the log file so that it can properly format whatever fields are contained in the log. In other words, even if you log a timestamp out as a long, you can view it with this tool as a formatted date. This will say you a few precious microseconds for each line you write to a log by not having to apply a DateFormat, and instead moves the expense of the formatting to the log viewer tool.
I am hoping to make this tool freely available sometime by the end of next week (Dec 21). If you are interested, please shoot me an email. After I get the kinks worked out, I will most likely donate it to Jakarta (if they'll have it). Included are some stripped-down I/O classes that are up to 40% faster than their java.io equivalents. Chad Stansbury ----- Original Message ----- From: "Bian Tan" <[EMAIL PROTECTED]> To: <avalon-dev@jakarta.apache.org> Sent: Wednesday, December 12, 2001 11:04 AM Subject: RE: Date Formatter for LogKitManagement > +1 > I would love to see date formatting in LogKit, to me this is an oversight as > the long time format is simply not human-readable. > > It would be better to cache the date formatter object, already you are > incurring the construction of a new date object everytime a message is > logged for each target that uses the formatter and this can add up in an app > with intense logging. No need to compound that by creating the date > formatter object over and over again. > > + import java.util.Date; > + import java.text.SimpleDateFormat; > ... > + SimpleDateFormat m_dateFormatter = null; > > protected String getTime( final long time, final String format ) > { > + if ( format == null ) > + { > return Long.toString( time ); > + } > + if (m_dateFormatter == null) { > + m_dateFormatter = new SimpleDateFormat( format ); > + } > + return( m_dateformatter.format( new Date( time ) ) ); > } > > -biant > > > -----Original Message----- > From: Bachran, Michael [mailto:[EMAIL PROTECTED] > > > Hi, > I would like to use a formatter using the simple date format for dates. It > might be usefull to everyone to have this integrated in the > LogKitManagement. So I would like to suggest patching the PatternFormatter > like this: > + import java.util.Date; > + import java.text.SimpleDateFormat; > ... > protected String getTime( final long time, final String format ) > { > + if ( format == null ) > + { > return Long.toString( time ); > + } > + SimpleDateFormat simpleDateFormat = new SimpleDateFormat( format ); > + return( simpleDateFormat.format( new Date( time ) ) ); > } > > > What do you think? > Michael > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>