add LoggerUtil to decide which Logger to get
All checks were successful
github-mirror / push-github (push) Successful in 5s
Build / Gradle-Build (push) Successful in 35s
Test / Gradle-Test (push) Successful in 39s

This commit is contained in:
tueem 2024-12-19 12:28:45 +01:00
parent 3de0f32074
commit a17f5e826f
Signed by: tueem
GPG Key ID: 65C8667EC17A88FB

View File

@ -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);
}
}