< prev index next >
jdk/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java
Print this page
*** 25,38 ****
package java.util.logging;
import java.io.*;
- import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
! import sun.util.logging.LoggingSupport;
/**
* Print a brief summary of the {@code LogRecord} in a human readable
* format. The summary will typically be 1 or 2 lines.
*
--- 25,37 ----
package java.util.logging;
import java.io.*;
import java.time.ZoneId;
import java.time.ZonedDateTime;
! 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,69 ****
*/
public class SimpleFormatter extends Formatter {
// format string for printing the log record
! private final String format = LoggingSupport.getSimpleFormat();
! private final ZoneId zoneId = ZoneId.systemDefault();
/**
* Format the given LogRecord.
* <p>
* The formatting can be customized by specifying the
--- 57,72 ----
*/
public class SimpleFormatter extends Formatter {
// format string for printing the log record
! 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,160 ****
* @return a formatted log record
*/
@Override
public synchronized String format(LogRecord record) {
ZonedDateTime zdt = ZonedDateTime.ofInstant(
! record.getInstant(), zoneId);
String source;
if (record.getSourceClassName() != null) {
source = record.getSourceClassName();
if (record.getSourceMethodName() != null) {
source += " " + record.getSourceMethodName();
--- 153,163 ----
* @return a formatted log record
*/
@Override
public synchronized String format(LogRecord record) {
ZonedDateTime zdt = ZonedDateTime.ofInstant(
! record.getInstant(), ZoneId.systemDefault());
String source;
if (record.getSourceClassName() != null) {
source = record.getSourceClassName();
if (record.getSourceMethodName() != null) {
source += " " + record.getSourceMethodName();
< prev index next >