diff --git a/lib/src/main/java/net/tomatentum/marinara/util/LoggerUtil.java b/lib/src/main/java/net/tomatentum/marinara/util/LoggerUtil.java new file mode 100644 index 0000000..99c57cd --- /dev/null +++ b/lib/src/main/java/net/tomatentum/marinara/util/LoggerUtil.java @@ -0,0 +1,20 @@ +package net.tomatentum.marinara.util; + +import java.util.Properties; + +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.simple.SimpleLogger; +import org.apache.logging.log4j.util.PropertiesUtil; +import org.apache.logging.log4j.util.ProviderUtil; + +public class LoggerUtil { + public static Logger getLogger(String name) { + if (ProviderUtil.hasProviders()) { + return LogManager.getLogger(name); + }else + return new SimpleLogger(name, Level.DEBUG, true, false, true, true, "yyyy-MM-dd HH:mm:ss.SSSZ", null, + new PropertiesUtil(new Properties()), System.out); + } +}