diff --git a/src/main/java/envoy/util/EnvoyLog.java b/src/main/java/envoy/util/EnvoyLog.java index 1e5193c..d64e69f 100644 --- a/src/main/java/envoy/util/EnvoyLog.java +++ b/src/main/java/envoy/util/EnvoyLog.java @@ -2,19 +2,19 @@ package envoy.util; import java.io.File; import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Date; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.logging.*; import envoy.data.Config; /** * Configures the {@link java.util.logging} API to output the log into the - * console and a log file.
- *
+ * console and a log file. + *

* Call the {@link EnvoyLog#attach(String)} method to configure a part of the - * logger hierarchy.
- *
+ * logger hierarchy. + *

* Project: envoy-client
* File: EnvoyLogger.java
* Created: 14 Dec 2019
@@ -46,13 +46,12 @@ public class EnvoyLog { // Configure log file final File logFile = new File((File) config.get("homeDirectory").get(), - "log/envoy_user_" + new SimpleDateFormat("yyyy-MM-dd--hh-mm-mm").format(new Date()) + ".log"); + "log/envoy_user_" + DateTimeFormatter.ofPattern("yyyy-MM-dd--hh-mm-mm").format(LocalDateTime.now()) + ".log"); logFile.getParentFile().mkdirs(); // Configure formatting - // Sample log entry: [2020-06-13 16:50:26] [INFORMATION] - // [envoy.client.ui.Startup] Closing connection... - System.setProperty("java.util.logging.SimpleFormatter.format", "[%1$tF %1$tT] [%4$-7s] [%3$s] %5$s %n"); + // Sample log entry: [2020-06-13 16:50:26] [INFORMATION] [envoy.client.ui.Startup] Closing connection... + System.setProperty("java.util.logging.SimpleFormatter.format", "[%1$tF %1$tT] [%4$-7s] [%3$s] %5$s %6$s%n"); final SimpleFormatter formatter = new SimpleFormatter(); try {