118 * the second line includes the log level ({@code 4$}) and
119 * the log message ({@code 5$}) followed with the throwable
120 * and its backtrace ({@code 6$}), if any:
121 * <pre>
122 * Tue Mar 22 13:11:31 PDT 2011 MyClass fatal
123 * SEVERE: several message with an exception
124 * java.lang.IllegalArgumentException: invalid argument
125 * at MyClass.mash(MyClass.java:9)
126 * at MyClass.crunch(MyClass.java:6)
127 * at MyClass.main(MyClass.java:3)
128 * </pre></li>
129 * <li> {@code java.util.logging.SimpleFormatter.format="%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s%n%4$s: %5$s%n"}
130 * <p>This prints 2 lines similar to the example above
131 * with a different date/time formatting and does not print
132 * the throwable and its backtrace:
133 * <pre>
134 * Mar 22, 2011 1:11:31 PM MyClass fatal
135 * SEVERE: several message with an exception
136 * </pre></li>
137 * <li> {@code java.util.logging.SimpleFormatter.format="%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS.%1$tN %1$Tp %2$s%n%4$s: %5$s%6$s%n"}
138 * <p>Since JDK 1.9, {@code java.util.logging} uses {@link
139 * java.time.Clock#systemUTC() java.time} to create more precise time
140 * stamps.
141 * The format above can be used to add a {@code .%1$tN} to the
142 * date/time formatting so that nanoseconds will also be printed:
143 * <pre>
144 * Feb 06, 2015 5:33:10.279216000 PM example.Main main
145 * INFO: This is a test
146 * </pre></li>
147 * </ul>
148 * <p>This method can also be overridden in a subclass.
149 * It is recommended to use the {@link Formatter#formatMessage}
150 * convenience method to localize and format the message field.
151 *
152 * @param record the log record to be formatted.
153 * @return a formatted log record
154 */
155 @Override
156 public synchronized String format(LogRecord record) {
157 ZonedDateTime zdt = ZonedDateTime.ofInstant(
158 record.getInstant(), ZoneId.systemDefault());
|
118 * the second line includes the log level ({@code 4$}) and
119 * the log message ({@code 5$}) followed with the throwable
120 * and its backtrace ({@code 6$}), if any:
121 * <pre>
122 * Tue Mar 22 13:11:31 PDT 2011 MyClass fatal
123 * SEVERE: several message with an exception
124 * java.lang.IllegalArgumentException: invalid argument
125 * at MyClass.mash(MyClass.java:9)
126 * at MyClass.crunch(MyClass.java:6)
127 * at MyClass.main(MyClass.java:3)
128 * </pre></li>
129 * <li> {@code java.util.logging.SimpleFormatter.format="%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s%n%4$s: %5$s%n"}
130 * <p>This prints 2 lines similar to the example above
131 * with a different date/time formatting and does not print
132 * the throwable and its backtrace:
133 * <pre>
134 * Mar 22, 2011 1:11:31 PM MyClass fatal
135 * SEVERE: several message with an exception
136 * </pre></li>
137 * <li> {@code java.util.logging.SimpleFormatter.format="%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS.%1$tN %1$Tp %2$s%n%4$s: %5$s%6$s%n"}
138 * <p>Since JDK 9, {@code java.util.logging} uses {@link
139 * java.time.Clock#systemUTC() java.time} to create more precise time
140 * stamps.
141 * The format above can be used to add a {@code .%1$tN} to the
142 * date/time formatting so that nanoseconds will also be printed:
143 * <pre>
144 * Feb 06, 2015 5:33:10.279216000 PM example.Main main
145 * INFO: This is a test
146 * </pre></li>
147 * </ul>
148 * <p>This method can also be overridden in a subclass.
149 * It is recommended to use the {@link Formatter#formatMessage}
150 * convenience method to localize and format the message field.
151 *
152 * @param record the log record to be formatted.
153 * @return a formatted log record
154 */
155 @Override
156 public synchronized String format(LogRecord record) {
157 ZonedDateTime zdt = ZonedDateTime.ofInstant(
158 record.getInstant(), ZoneId.systemDefault());
|