JDK-6285131 : java.util.logging.SimpleFormatter should be configurable to output milliseconds
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Future Project
  • OS: linux
  • CPU: x86
  • Submitted: 2005-06-14
  • Updated: 2012-01-24
  • Resolved: 2005-07-27
Description
A DESCRIPTION OF THE REQUEST :
There does not seem to be any way to make java.util.logging.SimpleFormatter output
the LogRecord time in milliseconds.


JUSTIFICATION :
Many applications require knowing when something happened with better than one second precision.

This functionality is so widely useful that it should be in the standard logging classes -
I should not have to find or write another class to do it.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would like to be able to generate log entries like this:

Jun 11, 2005 5:34:11.123 PM TestLogger main
INFO: testing

or this:

11/06/2005 16:35:27.123 TestLogger main
INFO: testing


ACTUAL -
I can only log this:

Jun 11, 2005 5:34:11 PM TestLogger main
INFO: testing

(no milliseconds)

or this:

11/06/2005 16:35:27 TestLogger main
INFO: testing

(again no milliseconds)


---------- BEGIN SOURCE ----------
import java.util.logging.*;


public class TestLogger
{
   static public void main( String[] args )
   {
      Logger.global.info( "testing" );
   }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
write my own class that extends java.util.logging.Formatter
###@###.### 2005-06-14 09:20:44 GMT