+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

Reply via email to