On 03/27/11 12:09, Alan Bateman wrote:
Mandy Chung wrote:
6381464: SimpleFormatter should use one single line format
This is a follow-up of the review for 7006814. I came up with a better
solution that allows a user to customize the output format for
SimpleFormatter.
You can specify the format string using the java.util.Formatter
syntax in
a new property: "java.util.logging.SimpleFormatter" that you can
customize
your own output format. See the javadoc for details:
http://cr.openjdk.java.net/~mchung/jdk7/6381464/api/java/util/logging/SimpleFormatter.html
Webrev at:
http://cr.openjdk.java.net/~mchung/jdk7/6381464/webrev.00/
It definitely make sense to do this in conjunction with 7006814. I've
gone through the webrev and it mostly looks good to me. A couple of
small comments:
Thanks for the feedback. It's the right thing to do.
SimpleFormatter L144-146, you could use a StringBuilder to build it up
when the source file is known.
I considered that. But I am not sure if this simple concatenation
worths the overhead of constructing the StringBuilder.
SimpleFormatter L156, I assume this should be %n rather than \n. Same
thing in PlatformLogger.
'\n' is a character added in the string created in L156 but not in a
format string in which %n is used to represents a newline.
SimpleFormatter L161, this pre-dates your changes but I don't see why
it catch Exception here. Same thing in PlatformLogger.
Good catch. I clean that up.
In logging.properties it might be good to extend the comment to
mention that the example generate one-line log messages.
Updated.
The new test has a copyright date of 2010, I assume this should be 2011.
Fixed - copy-n-paste error :)
Updated webrev:
http://cr.openjdk.java.net/~mchung/jdk7/6381464/webrev.01/
Thanks
Mandy