< prev index next >

jdk/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java

Print this page

        

@@ -25,14 +25,13 @@
 
 
 package java.util.logging;
 
 import java.io.*;
-import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
-import sun.util.logging.LoggingSupport;
+import jdk.internal.logger.SimpleConsoleLogger;
 
 /**
  * Print a brief summary of the {@code LogRecord} in a human readable
  * format.  The summary will typically be 1 or 2 lines.
  *

@@ -58,12 +57,16 @@
  */
 
 public class SimpleFormatter extends Formatter {
 
     // format string for printing the log record
-    private final String format = LoggingSupport.getSimpleFormat();
-    private final ZoneId zoneId = ZoneId.systemDefault();
+    static String getLoggingProperty(String name) {
+        return LogManager.getLogManager().getProperty(name);
+    }
+
+    private final String format =
+        SimpleConsoleLogger.getSimpleFormat(SimpleFormatter::getLoggingProperty);
 
     /**
      * Format the given LogRecord.
      * <p>
      * The formatting can be customized by specifying the

@@ -150,11 +153,11 @@
      * @return a formatted log record
      */
     @Override
     public synchronized String format(LogRecord record) {
         ZonedDateTime zdt = ZonedDateTime.ofInstant(
-                record.getInstant(), zoneId);
+                record.getInstant(), ZoneId.systemDefault());
         String source;
         if (record.getSourceClassName() != null) {
             source = record.getSourceClassName();
             if (record.getSourceMethodName() != null) {
                source += " " + record.getSourceMethodName();
< prev index next >