add LoggerUtil to decide which Logger to get
This commit is contained in:
parent
3de0f32074
commit
a17f5e826f
@ -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);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user