diff --git a/patterns/design-patterns-creational/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java b/patterns/design-patterns-creational/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java index f05a3baaa3..a602d1c55d 100644 --- a/patterns/design-patterns-creational/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java +++ b/patterns/design-patterns-creational/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java @@ -19,8 +19,8 @@ public class User { } public static User createWithLoggedInstantiationTime(String name, String email, String country) { - setLoggerProperties(); LOGGER.log(Level.INFO, "Creating User instance at : {0}", LocalTime.now()); + return new User(name, email, country); } @@ -53,11 +53,4 @@ public class User { public String getCountry() { return country; } - - private static void setLoggerProperties() { - ConsoleHandler handler = new ConsoleHandler(); - handler.setLevel(Level.INFO); - handler.setFormatter(new SimpleFormatter()); - LOGGER.addHandler(handler); - } }