-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
5.0
-
None
-
x86
-
linux
Many Logging API methods take an Object[] argument for a list of parameters to apply to some format. E.g.
http://download.java.net/jdk6/docs/api/java/util/logging/Logger.html#log(java.util.logging.Level,%20java.lang.String,%20java.lang.Object[])
or
http://download.java.net/jdk6/docs/api/java/util/logging/LogRecord.html#setParameters(java.lang.Object[])
It would be more convenient for these to use varargs syntax. E.g. for a message key like:
ERR-file-not-found=File {0} was not found in the directory {1}.
you currently have to write:
File f = ...;
logger.log(Level.WARNING, "ERR-file-not-found", new Object[] {f.getName(), f.getParentPath()});
where this would be more pleasant:
logger.log(Level.WARNING, "ERR-file-not-found", f.getName(), f.getParentPath());
Compare
http://download.java.net/jdk6/docs/api/java/text/MessageFormat.html#format(java.lang.String,%20java.lang.Object...)
http://download.java.net/jdk6/docs/api/java/util/logging/Logger.html#log(java.util.logging.Level,%20java.lang.String,%20java.lang.Object[])
or
http://download.java.net/jdk6/docs/api/java/util/logging/LogRecord.html#setParameters(java.lang.Object[])
It would be more convenient for these to use varargs syntax. E.g. for a message key like:
ERR-file-not-found=File {0} was not found in the directory {1}.
you currently have to write:
File f = ...;
logger.log(Level.WARNING, "ERR-file-not-found", new Object[] {f.getName(), f.getParentPath()});
where this would be more pleasant:
logger.log(Level.WARNING, "ERR-file-not-found", f.getName(), f.getParentPath());
Compare
http://download.java.net/jdk6/docs/api/java/text/MessageFormat.html#format(java.lang.String,%20java.lang.Object...)
- duplicates
-
JDK-5001993 Use varargs in java.util.logging.Logger
-
- Open
-