JDK-6381464 : SimpleFormatter should use one single line format
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Affected Version: 6,7
  • Priority: P5
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2006-02-06
  • Updated: 2017-05-16
  • Resolved: 2011-04-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b138Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
Default Java Logging Format uses two lines per log output.. Default logging format should be brief and without line seperators.

JUSTIFICATION :
Since default format uses a two line logging output, it is hard to read and follow by the developers. logging output seems cluttured. Although it is possible to define custom Formatters, many third party Java libraries uses the default format of the Java logger and does not bother making a custom formatter (such as Tomcat 5.5.x). i see developers  use log4j or other kind of third party logger mechanisms just because default format is ugly.
Default output first should tell what is the Level and the actual output, the other details (time, class, method) shoud be appended later. Of course the order of the default output format is my personal opininon..

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Default Java looger format it should be single line.

ACTUAL -
Formatter uses two lines per log output. Output seems confusing.

---------- BEGIN SOURCE ----------
package com.myCompany.project;

import java.util.logging.Logger;

public class DefaultLoggerTest {

    public static void main(String[] args) {
        Logger logger = Logger.getLogger(DefaultLoggerTest.class.getName());
        logger.info("Testing default format..");
    }
}

output:

Feb 3, 2006 11:40:39 PM com.myCompany.project.DefaultLoggerTest main
INFO: Testing default format..

can be shown in one such as like this (something better, or more brief can be written, this is just an example)

INFO: Testing default format.. [DefaultLoggerTest | main | Feb 3, 2006 11:40:39 PM | com.myCompany.project]
---------- END SOURCE ----------
This bug fix adds the following new SDK/JDK test:

    java/util/logging/SimpleFormatterFormat.java

This test is not valid for execution until JDK7-B138.
If this test is executed on older bits, it will fail.
However, this entry will make that failure appear on
the known fail_list.

Comments
EVALUATION Changeset URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/d2bbdd709307
29-03-2011

EVALUATION There are applications that depend on the current output format. The default format will remain the same so that it won't break existing applications and also the default format remains implementation-specific as different JDK implementation may have different default format.
25-03-2011

EVALUATION There is no single format that will satisfy all customers. In JDK 7, we will support a customizable format string specified in a "java.util.logging.SimpleFormatter.format" property using the java.util.Formatter format string syntax. If the specified format string is illegal, it falls back to use the default format rather than throwing an exception so that errors that occur while handling logging events - such as logging misconfiguration, network error - do not cause the application using logging to terminate prematurely. Same convention has been used in handling other configuration errors in the logging framework (e.g. a handler is configured to use a non-existence formatter class). Example usage: To print 1-line only with the log level and the log message, set the following in the logging.properties: java.util.logging.SimpleFormatter.format="%4$s: %5$s%n"
25-03-2011